summaryrefslogtreecommitdiffstats
path: root/Parser
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2007-10-21 02:45:33 (GMT)
committerBrett Cannon <bcannon@gmail.com>2007-10-21 02:45:33 (GMT)
commitc2954e5273520031d3debfac8c668b9e611303b3 (patch)
tree2817d481143f4332d43faf263b2279a27c7a063f /Parser
parente453989f2e6ea6d3a30c671f87313905d0c66e5e (diff)
downloadcpython-c2954e5273520031d3debfac8c668b9e611303b3.zip
cpython-c2954e5273520031d3debfac8c668b9e611303b3.tar.gz
cpython-c2954e5273520031d3debfac8c668b9e611303b3.tar.bz2
Make sure the malloc'ed string has space for the null byte.
Diffstat (limited to 'Parser')
-rw-r--r--Parser/tokenizer.c2
1 files changed, 1 insertions, 1 deletions
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 @@ PyTokenizer_FindEncoding(FILE *fp) {
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);