Skip to content

Commit e36352d

Browse files
fzwochLain-B
authored andcommitted
libobs/util: Fix potential memory error in text parser
Fixes memory access when parsing '#' comment tokens when the file immediately was EOF after this token.
1 parent 15ec211 commit e36352d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

libobs/util/text-lookup.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ static bool lookup_gettoken(struct lexer *lex, struct strref *str)
8888
if (!str->array) {
8989
/* comments are designated with a #, and end at LF */
9090
if (ch == '#') {
91-
while (ch != '\n' && ch != 0)
92-
ch = *(++lex->offset);
91+
while (*lex->offset != '\n' &&
92+
*lex->offset != 0)
93+
++lex->offset;
9394
} else if (temp.type == BASETOKEN_WHITESPACE) {
9495
strref_copy(str, &temp.text);
9596
break;

0 commit comments

Comments
 (0)