- 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 641e0b0..2f749af 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -220,6 +220,8 @@
- 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 abfca4e..02e9e53 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -360,7 +360,7 @@
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);