diff options
author | Brett Cannon <bcannon@gmail.com> | 2007-10-21 02:45:33 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2007-10-21 02:45:33 (GMT) |
commit | c2954e5273520031d3debfac8c668b9e611303b3 (patch) | |
tree | 2817d481143f4332d43faf263b2279a27c7a063f | |
parent | e453989f2e6ea6d3a30c671f87313905d0c66e5e (diff) | |
download | cpython-c2954e5273520031d3debfac8c668b9e611303b3.zip cpython-c2954e5273520031d3debfac8c668b9e611303b3.tar.gz cpython-c2954e5273520031d3debfac8c668b9e611303b3.tar.bz2 |
Make sure the malloc'ed string has space for the null byte.
-rw-r--r-- | Parser/tokenizer.c | 2 |
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); |