[Python-3000-checkins] r61311 - python/branches/py3k/Modules/_localemodule.c

martin.v.loewis python-3000-checkins at python.org
Sat Mar 8 14:39:58 CET 2008


Author: martin.v.loewis
Date: Sat Mar  8 14:39:58 2008
New Revision: 61311

Modified:
   python/branches/py3k/Modules/_localemodule.c
Log:
Fix another buffer overflow.


Modified: python/branches/py3k/Modules/_localemodule.c
==============================================================================
--- python/branches/py3k/Modules/_localemodule.c	(original)
+++ python/branches/py3k/Modules/_localemodule.c	Sat Mar  8 14:39:58 2008
@@ -58,7 +58,7 @@
         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));


More information about the Python-3000-checkins mailing list