re PR preprocessor/3260 (#include __FILE__ broken)
authorNeil Booth <neil@cat.daikokuya.demon.co.uk>
Thu, 21 Jun 2001 20:56:07 +0000 (20:56 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Thu, 21 Jun 2001 20:56:07 +0000 (20:56 +0000)
PR preprocessor/3260
* cppmacro.c (make_string_token): Null terminate.

From-SVN: r43492

gcc/ChangeLog
gcc/cppmacro.c

index 006f16d034ba56ca2cc2e06928443d023ebb9df6..1227fefd1397ccf1a4c59ab8c8ea5b40e1f1767b 100644 (file)
@@ -1,3 +1,7 @@
+2001-06-21  Neil Booth  <neil@cat.daikokuya.demon.co.uk>
+
+       * cppmacro.c (make_string_token): Null terminate.
+
 2001-06-21  DJ Delorie  <dj@redhat.com>
 
        * config/alpha/alpha.h (struct machine_function): Remove.
index 40c61762ed84ce5563b325a3ce143b0c72d6b6e7..d8ef424a96b495db0905bde6b7a5380d625000c5 100644 (file)
@@ -105,11 +105,12 @@ make_string_token (pool, token, text, len)
      const U_CHAR *text;
      unsigned int len;
 {
-  U_CHAR *buf = _cpp_pool_alloc (pool, len * 4);
+  U_CHAR *buf = _cpp_pool_alloc (pool, len * 4 + 1);
 
   token->type = CPP_STRING;
   token->val.str.text = buf;
   token->val.str.len = quote_string (buf, text, len) - buf;
+  token->val.str.text[token->val.str.len] = '\0';
   token->flags = 0;
 }