From 5d2d2ef1f5b23abf8d67437fb7288644053657eb Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Tue, 3 Apr 2007 04:39:34 +0000 Subject: [PATCH] - Fix an off-by-one bug in locale.strxfrm(). Patch taken from http://bugs.debian.org/416934. --- Misc/NEWS | 2 ++ Modules/_localemodule.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 641e0b0fba..2f749af894 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 abfca4eb16..02e9e53b27 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); -- 2.50.1