Skip to content

Commit

Permalink
Add missing EOF checks
Browse files Browse the repository at this point in the history
  • Loading branch information
sauwming committed Nov 2, 2023
1 parent 581b2c7 commit 940cef7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pjlib-util/src/pjlib-util/scanner.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ PJ_DEF(void) pj_scan_skip_whitespace( pj_scanner *scanner )
for (; PJ_SCAN_CHECK_EOF(s); ) {
if (*s == '\r') {
++s;
if (!PJ_SCAN_CHECK_EOF(s)) break;
if (*s == '\n') ++s;
++scanner->line;
scanner->curptr = scanner->start_line = s;
Expand All @@ -162,7 +163,7 @@ PJ_DEF(void) pj_scan_skip_whitespace( pj_scanner *scanner )
} else if (PJ_SCAN_IS_SPACE(*s)) {
do {
++s;
} while (PJ_SCAN_IS_SPACE(*s));
} while (PJ_SCAN_CHECK_EOF(s) && PJ_SCAN_IS_SPACE(*s));
} else {
break;
}
Expand Down

0 comments on commit 940cef7

Please sign in to comment.