Skip to content

Commit

Permalink
common/str_map.cc: do boundry checks before access
Browse files Browse the repository at this point in the history
Signed-off-by: Danny Al-Gaaf <[email protected]>
  • Loading branch information
dalgaaf committed Apr 13, 2018
1 parent 1de5d14 commit 84b8387
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/str_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ int get_json_str_map(
string trim(const string& str) {
size_t start = 0;
size_t end = str.size() - 1;
while (isspace(str[start]) != 0 && start <= end) {
while (start <= end && isspace(str[start]) != 0) {
++start;
}
while (isspace(str[end]) != 0 && start <= end) {
while (start <= end && isspace(str[end]) != 0) {
--end;
}
if (start <= end) {
Expand Down

0 comments on commit 84b8387

Please sign in to comment.