Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().

Found by Coverity.
This commit is contained in:
Stefan Krah 2012-08-20 11:04:24 +02:00
parent e56bf97ef4
commit fd24f9e51e
2 changed files with 18 additions and 0 deletions

View file

@ -2736,6 +2736,11 @@ _PySequence_BytesToCharpArray(PyObject* self)
for (i = 0; i < argc; ++i) {
char *data;
item = PySequence_GetItem(self, i);
if (item == NULL) {
/* NULL terminate before freeing. */
array[i] = NULL;
goto fail;
}
data = PyBytes_AsString(item);
if (data == NULL) {
/* NULL terminate before freeing. */