[Python-checkins] cpython (merge 3.3 -> default): Fix possible NULL pointer dereference in PyCurses_Start_Color()

christian.heimes python-checkins at python.org
Fri Jul 26 14:46:18 CEST 2013


http://hg.python.org/cpython/rev/3c5bf0c7a290
changeset:   84830:3c5bf0c7a290
parent:      84828:2f4c4db9aee5
parent:      84829:aedcf7ef8489
user:        Christian Heimes <christian at cheimes.de>
date:        Fri Jul 26 14:46:02 2013 +0200
summary:
  Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276

files:
  Modules/_cursesmodule.c |  4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2926,9 +2926,13 @@
     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);

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list