mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-28 10:56:18 +03:00
Include a null byte at the end of the string, length doesn't include it
Fixes #2758
This commit is contained in:
parent
b0b2009c58
commit
7e484eba77
|
@ -2212,7 +2212,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){
|
|||
PyBytes_AsStringAndSize(encoded_string, &buffer, &len);
|
||||
}
|
||||
|
||||
*text = calloc(len,1);
|
||||
*text = calloc(len+1,1);
|
||||
if (*text) {
|
||||
memcpy(*text, buffer, len);
|
||||
}
|
||||
|
@ -2230,7 +2230,7 @@ void _font_text_asBytes(PyObject* encoded_string, unsigned char** text){
|
|||
PyString_AsStringAndSize(encoded_string, &buffer, &len);
|
||||
*text = calloc(len,1);
|
||||
if (*text) {
|
||||
memcpy(*text, buffer, len);
|
||||
memcpy(*text, buffer, len+1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user