]> git.proxmox.com Git - ovs.git/commitdiff
lex: Fix parsing of long tokens.
authorBen Pfaff <blp@ovn.org>
Tue, 2 Jan 2018 19:15:42 +0000 (11:15 -0800)
committerBen Pfaff <blp@ovn.org>
Mon, 8 Jan 2018 19:17:20 +0000 (11:17 -0800)
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 <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
ovn/lib/lex.c

index 6f2b570f5c65ade6a02f4e843f828e23c995a8b2..2f49af0e91e2a909a6f611477d5159175e72457a 100644 (file)
@@ -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