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: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5bacec1864d35297b19ec8e6de99f758ee12e0e2;p=python Fix another buffer overflow. --- diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c index 1fba6b159d..af36a59eef 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));