]> granicus.if.org Git - python/commitdiff
- Fix an off-by-one bug in locale.strxfrm().
authorMatthias Klose <doko@ubuntu.com>
Tue, 3 Apr 2007 04:35:59 +0000 (04:35 +0000)
committerMatthias Klose <doko@ubuntu.com>
Tue, 3 Apr 2007 04:35:59 +0000 (04:35 +0000)
  patch taken from http://bugs.debian.org/416934.

Misc/NEWS
Modules/_localemodule.c

index 9da3d3bc2ffe1f8897be7782b6dc79ad2d926a17..8ef7acb639ff3b2bd4887fb8a670e343f7054926 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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
 -----
 
index abfca4eb163b4a5fe8982228e95482d8b69f6e8d..02e9e53b274526fa787eb5149618c306cae73a52 100644 (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);