summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-18 16:44:31 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-08-18 16:44:31 -0700
commited0147e182cc739ae77c34675080e14d498492b2 (patch)
tree9636a210ac6c13dc24818bd137033fdc7b1e7993
parent6beb9e93f64256837ff3cc34f171d7abe86e184c (diff)
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: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--src/conn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/conn.c b/src/conn.c
index 39833c8..1b21d17 100644
--- a/src/conn.c
+++ b/src/conn.c
@@ -319,7 +319,7 @@ xpybConn_call(xpybConn *self, PyObject *args, PyObject *kw)
/* Check our dictionary of cached values */
ext = xpybConn_load_ext(self, key);
- if (!ext->present) {
+ if (ext != NULL && !ext->present) {
PyErr_SetString(xpybExcept_ext, "Extension not present on server.");
Py_DECREF(ext);
return NULL;