From: Martin v. Löwis Date: Sat, 8 Mar 2008 13:39:58 +0000 (+0000) Subject: Fix another buffer overflow. X-Git-Tag: v3.0a4~177 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5bacec1864d35297b19ec8e6de99f758ee12e0e2;p=thirdparty%2FPython%2Fcpython.git Fix another buffer overflow. --- diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 1fba6b159d64..af36a59eef8e 100644 --- a/Modules/_localemodule.c +++ b/Modules/_localemodule.c @@ -58,7 +58,7 @@ str2uni(const char* s) PyErr_SetString(PyExc_ValueError, "Cannot convert byte to string"); return NULL; } - if (needed < sizeof(smallbuf)) + if (needed*sizeof(wchar_t) < sizeof(smallbuf)) dest = smallbuf; else { dest = PyMem_Malloc((needed+1)*sizeof(wchar_t));