Skip to content

Commit

Permalink
lex: Fix parsing of long tokens.
Browse files Browse the repository at this point in the history
When a token is longer than the built-in 256-byte buffer, a buffer is
malloc()'d but it was not properly null-terminated.

Found by afl-fuzz.

Reported-by: Bhargava Shastry <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
Reviewed-by: Greg Rose <[email protected]>
  • Loading branch information
blp committed Jan 8, 2018
1 parent 8b54e31 commit 7173efa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ovn/lib/lex.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ lex_token_strcpy(struct lex_token *token, const char *s, size_t length)
? token->buffer
: xmalloc(length + 1));
memcpy(token->s, s, length);
token->buffer[length] = '\0';
token->s[length] = '\0';
}

void
Expand Down

0 comments on commit 7173efa

Please sign in to comment.