Fix another buffer overflow.

This commit is contained in:
Martin v. Löwis 2008-03-08 13:39:58 +00:00
parent 0f95ba9341
commit 5bacec1864
1 changed files with 1 additions and 1 deletions

View 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));