]> 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:39:34 +0000 (04:39 +0000)
committerMatthias Klose <doko@ubuntu.com>
Tue, 3 Apr 2007 04:39:34 +0000 (04:39 +0000)
  Patch taken from http://bugs.debian.org/416934.

Misc/NEWS
Modules/_localemodule.c

index 641e0b0fba442a653c61388bd268a58a770b07c0..2f749af8946c8807c043039e81adbd0a940477a7 100644 (file)
--- 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
 -------
 
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);