]> granicus.if.org Git - python/commitdiff
Fix another buffer overflow.
authorMartin v. Löwis <martin@v.loewis.de>
Sat, 8 Mar 2008 13:39:58 +0000 (13:39 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Sat, 8 Mar 2008 13:39:58 +0000 (13:39 +0000)
Modules/_localemodule.c

index 1fba6b159d6488bd89370df492554c309917f25f..af36a59eef8e687812391c6fc4bd5aa54dc524c6 100644 (file)
@@ -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));