From e5328855987294b4d79aafddcd146af9d414e14c Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 13 Feb 2016 20:59:51 +0100 Subject: [PATCH] Fix crash on Mac OS X when parsing the command line parameters --- src/cryfs/cli/program_options/utils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cryfs/cli/program_options/utils.cpp b/src/cryfs/cli/program_options/utils.cpp index 2c2f0d2d..4ea052f9 100644 --- a/src/cryfs/cli/program_options/utils.cpp +++ b/src/cryfs/cli/program_options/utils.cpp @@ -15,7 +15,9 @@ namespace cryfs { vector afterDoubleDash; afterDoubleDash.reserve(options.size()-beforeDoubleDash.size()+1); afterDoubleDash.push_back(options[0]); - std::copy(doubleDashIterator+1, options.end(), std::back_inserter(afterDoubleDash)); + if (options.end() >= doubleDashIterator+1) { + std::copy(doubleDashIterator + 1, options.end(), std::back_inserter(afterDoubleDash)); + } return make_pair( beforeDoubleDash, afterDoubleDash