Author: brett.cannon
Date: Sun Oct 21 04:45:33 2007
New Revision: 58575

Modified:
   python/branches/py3k/Parser/tokenizer.c
Log:
Make sure the malloc'ed string has space for the null byte.


Modified: python/branches/py3k/Parser/tokenizer.c
==============================================================================
--- python/branches/py3k/Parser/tokenizer.c     (original)
+++ python/branches/py3k/Parser/tokenizer.c     Sun Oct 21 04:45:33 2007
@@ -1631,7 +1631,7 @@
        lseek(fileno(fp), 0, 0);
 
        if (tok->encoding) {
-            encoding = (char *)PyMem_MALLOC(strlen(tok->encoding));
+            encoding = (char *)PyMem_MALLOC(strlen(tok->encoding) + 1);
             strcpy(encoding, tok->encoding);
         }
        PyTokenizer_Free(tok);
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to