Skip to content
Snippets Groups Projects
Commit ed0147e1 authored by Alan Coopersmith's avatar Alan Coopersmith
Browse files

xpybConn_call should ensure ext is not NULL before using it


Found by Oracle's Parfait 1.2 static analyzer:
   Null pointer dereference (CWE 476): Read from null pointer ext
        at line 322 of /export/alanc/X.Org/amd64-parfait/xcb/xpyb/src/conn.c
            in function 'xpybConn_call'.
          Function xpybConn_load_ext may return constant 'NULL' at line 141,
              called at line 321.
          Null pointer introduced at line 141 in function 'xpybConn_load_ext'.

Signed-off-by: default avatarAlan Coopersmith <alan.coopersmith@oracle.com>
parent 6beb9e93
No related branches found
No related tags found
No related merge requests found
...@@ -319,7 +319,7 @@ xpybConn_call(xpybConn *self, PyObject *args, PyObject *kw) ...@@ -319,7 +319,7 @@ xpybConn_call(xpybConn *self, PyObject *args, PyObject *kw)
/* Check our dictionary of cached values */ /* Check our dictionary of cached values */
ext = xpybConn_load_ext(self, key); ext = xpybConn_load_ext(self, key);
if (!ext->present) { if (ext != NULL && !ext->present) {
PyErr_SetString(xpybExcept_ext, "Extension not present on server."); PyErr_SetString(xpybExcept_ext, "Extension not present on server.");
Py_DECREF(ext); Py_DECREF(ext);
return NULL; return NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment