Skip to content

Commit

Permalink
libexpr: Fix read out-of-bound on the heap
Browse files Browse the repository at this point in the history
Signed-off-by: Pamplemousse <[email protected]>
  • Loading branch information
Pamplemousse committed Jul 14, 2021
1 parent 9cf991f commit 99f8fc9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/libexpr/lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ static void adjustLoc(YYLTYPE * loc, const char * s, size_t len)
loc->first_line = loc->last_line;
loc->first_column = loc->last_column;

while (len--) {
for (size_t i = 0; i < len; i++) {
switch (*s++) {
case '\r':
if (*s == '\n') /* cr/lf */
if (*s == '\n') { /* cr/lf */
i++;
s++;
}
/* fall through */
case '\n':
++loc->last_line;
Expand Down

0 comments on commit 99f8fc9

Please sign in to comment.