Make sure the malloc'ed string has space for the null byte.

This commit is contained in:
Brett Cannon 2007-10-21 02:45:33 +00:00
parent e453989f2e
commit c2954e5273
1 changed files with 1 additions and 1 deletions

View File

@ -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);