[Python-checkins] cpython (2.7): Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV.

serhiy.storchaka python-checkins at python.org
Fri Jan 30 22:36:08 CET 2015


https://hg.python.org/cpython/rev/e5d79e6deeb5
changeset: 94399:e5d79e6deeb5
branch: 2.7
user: Serhiy Storchaka <storchaka at gmail.com>
date: Fri Jan 30 23:35:03 2015 +0200
summary:
 Issue #23055: Fixed off-by-one error in PyUnicode_FromFormatV.
files:
 Objects/unicodeobject.c | 3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -893,7 +893,8 @@
 }
 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;
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /