mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Make sure the malloc'ed string has space for the null byte.
This commit is contained in:
parent
e453989f2e
commit
c2954e5273
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue