summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2012-08-20 09:04:24 (GMT)
committerStefan Krah <skrah@bytereef.org>2012-08-20 09:04:24 (GMT)
commitfd24f9e51e80fb050e4239f6909eaff2d29ec30d (patch)
tree0b9630a2ee3f5252c781ca9fef9207578dbbd43e /Objects
parente56bf97ef4283a877c459390516bb7385e8e4ec4 (diff)
downloadcpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.zip
cpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.tar.gz
cpython-fd24f9e51e80fb050e4239f6909eaff2d29ec30d.tar.bz2
Issue #15732: Fix (constructed) crash in _PySequence_BytesToCharpArray().
Found by Coverity.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/abstract.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 2f887aa..299daf5 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -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. */