mojoshader_preprocessor.c
changeset 641 2002d0399ef2
parent 640 813a139a4a5a
child 642 624ab8696f9b
--- a/mojoshader_preprocessor.c	Tue Feb 17 00:38:15 2009 -0500
+++ b/mojoshader_preprocessor.c	Tue Feb 17 00:57:09 2009 -0500
@@ -870,9 +870,9 @@
     void *d = ctx->malloc_data;
     const char space = ' ';
     unsigned int len = ((unsigned int) (state->source-state->token));
-    char *sym = (char *) alloca(len);
-    memcpy(sym, state->token, len-1);
-    sym[len-1] = '\0';
+    char *sym = (char *) alloca(len+1);
+    memcpy(sym, state->token, len);
+    sym[len] = '\0';
 
     Buffer buffer;
     init_buffer(&buffer);
@@ -939,9 +939,9 @@
     } // if
 
     const unsigned int len = ((unsigned int) (state->source-state->token));
-    char *sym = (char *) alloca(len);
-    memcpy(sym, state->token, len-1);
-    sym[len-1] = '\0';
+    char *sym = (char *) alloca(len+1);
+    memcpy(sym, state->token, len);
+    sym[len] = '\0';
 
     if (!require_newline(state))
     {
@@ -966,9 +966,9 @@
     } // if
 
     const unsigned int len = ((unsigned int) (state->source-state->token));
-    char *sym = (char *) alloca(len);
-    memcpy(sym, state->token, len-1);
-    sym[len-1] = '\0';
+    char *sym = (char *) alloca(len+1);
+    memcpy(sym, state->token, len);
+    sym[len] = '\0';
 
     if (!require_newline(state))
     {