From: Danny Al-Gaaf Date: Fri, 13 Apr 2018 13:50:07 +0000 (+0200) Subject: common/str_map.cc: do boundry checks before access X-Git-Tag: v13.1.0~237^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=84b838764bbfad09da23826533fffcdf376c1090;p=ceph.git common/str_map.cc: do boundry checks before access Signed-off-by: Danny Al-Gaaf --- diff --git a/src/common/str_map.cc b/src/common/str_map.cc index c3f6a2b6519e..6e952ab8419d 100644 --- a/src/common/str_map.cc +++ b/src/common/str_map.cc @@ -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) {