Commit 8a6fabed authored by Steve's avatar Steve Committed by GitHub

Avoid segmentation fault

Change `<=` to `<` to avoid accessing the first character of an empty string
parent 7dd3723a
...@@ -10,7 +10,7 @@ static const char* noneValue = "<none>"; ...@@ -10,7 +10,7 @@ static const char* noneValue = "<none>";
static String cat_string(const String& str) static String cat_string(const String& str)
{ {
int left = 0, right = (int)str.length(); int left = 0, right = (int)str.length();
while( left <= right && str[left] == ' ' ) while( left < right && str[left] == ' ' )
left++; left++;
while( right > left && str[right-1] == ' ' ) while( right > left && str[right-1] == ' ' )
right--; right--;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment