Fixed bug in q2c when munging hyphenated strings.
[pspp-builds.git] / src / language / lexer / q2c.c
index ea4e348148b29febf66718075ca8aabfef77eb29..be0f29c5216ac392209e3e075a6df469208b54b2 100644 (file)
@@ -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;
 }