Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a956e64

Browse files
committed
Fix possible NULL pointer dereference in PyCurses_Start_Color()
CID 1058276
1 parent 845f784 commit a956e64

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Modules/_cursesmodule.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2930,9 +2930,13 @@ PyCurses_Start_Color(PyObject *self)
29302930
if (code != ERR) {
29312931
initialisedcolors = TRUE;
29322932
c = PyLong_FromLong((long) COLORS);
2933+
if (c == NULL)
2934+
return NULL;
29332935
PyDict_SetItemString(ModDict, "COLORS", c);
29342936
Py_DECREF(c);
29352937
cp = PyLong_FromLong((long) COLOR_PAIRS);
2938+
if (cp == NULL)
2939+
return NULL;
29362940
PyDict_SetItemString(ModDict, "COLOR_PAIRS", cp);
29372941
Py_DECREF(cp);
29382942
Py_INCREF(Py_None);

0 commit comments

Comments
 (0)