From c2954e5273520031d3debfac8c668b9e611303b3 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sun, 21 Oct 2007 02:45:33 +0000 Subject: Make sure the malloc'ed string has space for the null byte. --- Parser/tokenizer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v0.12