Skip to content

Commit

Permalink
Fix potential for overflow during tokenization
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4rr0 committed Apr 24, 2024
1 parent 213bfb8 commit 8c76c44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tokenize.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ static inline void tokenize(
while (string::npos != pos || string::npos != lastPos) {
string::size_type rtrim = pos;
while (isspace(s[lastPos])) lastPos++;
while (isspace(s[rtrim - 1])) rtrim--;
while (rtrim > 0 && isspace(s[rtrim - 1])) rtrim--;
ss.push_back(s.substr(lastPos, rtrim - lastPos));
lastPos = s.find_first_not_of(delims, pos);
pos = s.find_first_of(delims, lastPos);
Expand Down

0 comments on commit 8c76c44

Please sign in to comment.