commit | c2954e5273520031d3debfac8c668b9e611303b3 | [log] [tgz] |
---|---|---|
author | Brett Cannon <bcannon@gmail.com> | Sun Oct 21 02:45:33 2007 +0000 |
committer | Brett Cannon <bcannon@gmail.com> | Sun Oct 21 02:45:33 2007 +0000 |
tree | 2817d481143f4332d43faf263b2279a27c7a063f | |
parent | e453989f2e6ea6d3a30c671f87313905d0c66e5e [diff] |
Make sure the malloc'ed string has space for the null byte.
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c index c86fe7e..8c24cf2 100644 --- a/Parser/tokenizer.c +++ b/Parser/tokenizer.c
@@ -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);