- Fix an off-by-one bug in locale.strxfrm().

patch taken from http://bugs.debian.org/416934.
This commit is contained in:
Matthias Klose 2007-04-03 04:35:59 +00:00
parent 9e56d5beeb
commit e19e0c21ae
2 changed files with 4 additions and 1 deletions

View File

@ -681,6 +681,9 @@ 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().
Tests
-----

View File

@ -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);