summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-26 12:46:02 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-26 12:46:02 (GMT)
commitef86368ea6f92af6192355fea382dc9dd65ecd1d (patch)
treeae9ee9a5b9296fea2f4a15be89e4bbd4eff5d50f /Modules
parent5d7c1b1a2b09eb17621201b4b158cdab0b35a0f1 (diff)
parenta956e645c10051cada87abc90248b112df7e1974 (diff)
downloadcpython-ef86368ea6f92af6192355fea382dc9dd65ecd1d.zip
cpython-ef86368ea6f92af6192355fea382dc9dd65ecd1d.tar.gz
cpython-ef86368ea6f92af6192355fea382dc9dd65ecd1d.tar.bz2
Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_cursesmodule.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 5d14898..27e5579 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2926,9 +2926,13 @@ PyCurses_Start_Color(PyObject *self)
if (code != ERR) {
initialisedcolors = TRUE;
c = PyLong_FromLong((long) COLORS);
+ if (c == NULL)
+ return NULL;
PyDict_SetItemString(ModDict, "COLORS", c);
Py_DECREF(c);
cp = PyLong_FromLong((long) COLOR_PAIRS);
+ if (cp == NULL)
+ return NULL;
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
Py_DECREF(cp);
Py_INCREF(Py_None);