mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().
Found by Coverity.
This commit is contained in:
parent
e56bf97ef4
commit
fd24f9e51e
2 changed files with 18 additions and 0 deletions
|
@ -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. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue