From 8a6fabed83b3bf7eea5413a7de62f5e12c1afbe8 Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 29 Dec 2016 17:23:40 -0800 Subject: [PATCH] Avoid segmentation fault Change `<=` to `<` to avoid accessing the first character of an empty string --- modules/core/src/command_line_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/command_line_parser.cpp b/modules/core/src/command_line_parser.cpp index 542b231..4fc6223 100644 --- a/modules/core/src/command_line_parser.cpp +++ b/modules/core/src/command_line_parser.cpp @@ -10,7 +10,7 @@ static const char* noneValue = ""; static String cat_string(const String& str) { int left = 0, right = (int)str.length(); - while( left <= right && str[left] == ' ' ) + while( left < right && str[left] == ' ' ) left++; while( right > left && str[right-1] == ' ' ) right--; -- 2.7.4