lex: Fix parsing of long tokens.
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
@@ -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
