From: Matthias Klose Date: Tue, 3 Apr 2007 04:39:34 +0000 (+0000) Subject: - Fix an off-by-one bug in locale.strxfrm(). X-Git-Tag: v2.5.1c1~5 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d2d2ef1f5b23abf8d67437fb7288644053657eb;p=thirdparty%2FPython%2Fcpython.git - Fix an off-by-one bug in locale.strxfrm(). Patch taken from http://bugs.debian.org/416934. --- diff --git a/Misc/NEWS b/Misc/NEWS index 641e0b0fba44..2f749af8946c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -220,6 +220,8 @@ Extension Modules - Bug #1633621: if curses.resizeterm() or curses.resize_term() is called, update _curses.LINES, _curses.COLS, curses.LINES and curses.COLS. +- Fix an off-by-one bug in locale.strxfrm(). + Library ------- diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index abfca4eb163b..02e9e53b2745 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -360,7 +360,7 @@ PyLocale_strxfrm(PyObject* self, PyObject* args) buf = PyMem_Malloc(n1); if (!buf) return PyErr_NoMemory(); - n2 = strxfrm(buf, s, n1); + n2 = strxfrm(buf, s, n1) + 1; if (n2 > n1) { /* more space needed */ buf = PyMem_Realloc(buf, n2);