Commit 426d548e authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV.

parent e0251d34
...@@ -893,7 +893,8 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) ...@@ -893,7 +893,8 @@ PyUnicode_FromFormatV(const char *format, va_list vargs)
} }
expand: expand:
if (abuffersize > 20) { if (abuffersize > 20) {
abuffer = PyObject_Malloc(abuffersize); /* add 1 for sprintf's trailing null byte */
abuffer = PyObject_Malloc(abuffersize + 1);
if (!abuffer) { if (!abuffer) {
PyErr_NoMemory(); PyErr_NoMemory();
goto fail; goto fail;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment