From 82a5c1c48a6a8a1ed8f7f4cbdd07785793ff2926 Mon Sep 17 00:00:00 2001 From: rlar Date: Wed, 31 Dec 2014 15:04:04 +0100 Subject: [PATCH] inpcom.c, inp_remove_ws(), avoid appending a surplus '\0' --- src/frontend/inpcom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 24b3f9fd3..f6402acd7 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2199,7 +2199,7 @@ static char* inp_remove_ws(char *s) { char *x = s; - char *big_buff = TMALLOC(char, strlen(s) + 2); + char *big_buff = TMALLOC(char, strlen(s) + 1); char *d = big_buff; char *buffer; bool is_expression = FALSE; @@ -2214,6 +2214,9 @@ inp_remove_ws(char *s) if (*s == '=' || (is_expression && (is_arith_char(*s) || *s == ','))) { s = skip_ws(s + 1); + if (*s == '\0') + continue; + if (*s == '{') is_expression = TRUE; if (*s == '}')