From 15d25f33d8af81f11ac05379ae267f85da2b3077 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 14 Apr 2009 07:07:14 +0800 Subject: [PATCH] Fixed bug in q2c when munging hyphenated strings. Q2c wasn't terminating strings generated by its munge function, resulting in garbage being placed into generated code. Thanks to Michel Boaventura for reporting this. --- src/language/lexer/q2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/language/lexer/q2c.c b/src/language/lexer/q2c.c index ea4e3481..be0f29c5 100644 --- a/src/language/lexer/q2c.c +++ b/src/language/lexer/q2c.c @@ -379,7 +379,7 @@ id_cpy (char **cp) static char * unmunge (const char *s) { - char *dest = xmalloc (strlen (s)); + char *dest = xmalloc (strlen (s) + 1); char *d = dest; while (*s) @@ -391,6 +391,7 @@ unmunge (const char *s) s++; d++; } + *d = '\0'; return dest; } -- 2.30.2