From 184130ccf0e9b1b38118e6ed4a1760d21e3c2e79 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 27 May 2008 01:24:12 +0000 Subject: [PATCH] Fixed four off by ones (undefined string termination) --- src/cpp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cpp.c b/src/cpp.c index 054c47c..0af2575 100644 --- a/src/cpp.c +++ b/src/cpp.c @@ -229,7 +229,7 @@ static char * _cpp_parse_line(Parser * parser, int c) do { - if((p = realloc(str, len + 1)) == NULL) + if((p = realloc(str, len + 2)) == NULL) { error_set_code(1, "%s", strerror(errno)); free(str); @@ -253,7 +253,7 @@ static char * _cpp_parse_word(Parser * parser, int c) do { - if((p = realloc(str, len + 1)) == NULL) + if((p = realloc(str, len + 2)) == NULL) { error_set_code(1, "%s", strerror(errno)); free(str); @@ -439,7 +439,7 @@ static int _cpp_callback_whitespace(Parser * parser, Token * token, int c, { if(c != '\n') continue; - if((p = realloc(str, len + 1)) == NULL) + if((p = realloc(str, len + 2)) == NULL) { free(str); return -1; @@ -495,7 +495,7 @@ static int _cpp_callback_otherspace(Parser * parser, Token * token, int c, #endif do { - if((p = realloc(str, len + 1)) == NULL) + if((p = realloc(str, len + 2)) == NULL) { free(str); return -1;