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

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


http://hg.python.org/cpython/rev/aedcf7ef8489
changeset:   84829:aedcf7ef8489
branch:      3.3
parent:      84827:78e8980ec9f7
user:        Christian Heimes <christian at cheimes.de>
date:        Fri Jul 26 14:45:37 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
@@ -2930,9 +2930,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