From: Serhiy Storchaka Date: Fri, 30 Jan 2015 21:35:03 +0000 (+0200) Subject: Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV. X-Git-Tag: v2.7.10rc1~208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ec0bbf27dfef0d486dca1177d8c86f37969474e;p=thirdparty%2FPython%2Fcpython.git Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV. --- diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 2e5f5fd848cd..1e3b812528b7 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -893,7 +893,8 @@ PyUnicode_FromFormatV(const char *format, va_list vargs) } expand: if (abuffersize > 20) { - abuffer = PyObject_Malloc(abuffersize); + /* add 1 for sprintf's trailing null byte */ + abuffer = PyObject_Malloc(abuffersize + 1); if (!abuffer) { PyErr_NoMemory(); goto fail;