Applied patch for [ 1047269 ] Buffer overwrite in PyUnicode_AsWideChar.

Python 2.3.x candidate.
This commit is contained in:
Marc-André Lemburg 2004-10-15 07:45:05 +00:00
parent 5e7d51b62c
commit 204bd6d9d2

View file

@ -368,7 +368,7 @@ PyObject *PyUnicode_FromWideChar(register const wchar_t *w,
register Py_UNICODE *u; register Py_UNICODE *u;
register int i; register int i;
u = PyUnicode_AS_UNICODE(unicode); u = PyUnicode_AS_UNICODE(unicode);
for (i = size; i >= 0; i--) for (i = size; i > 0; i--)
*u++ = *w++; *u++ = *w++;
} }
#endif #endif
@ -393,7 +393,7 @@ int PyUnicode_AsWideChar(PyUnicodeObject *unicode,
register Py_UNICODE *u; register Py_UNICODE *u;
register int i; register int i;
u = PyUnicode_AS_UNICODE(unicode); u = PyUnicode_AS_UNICODE(unicode);
for (i = size; i >= 0; i--) for (i = size; i > 0; i--)
*w++ = *u++; *w++ = *u++;
} }
#endif #endif