py: Make sure we do not dereference a NULL pointer
authorAndreas Schneider <asn@samba.org>
Thu, 10 Dec 2015 16:30:57 +0000 (17:30 +0100)
committerMichael Adam <obnox@samba.org>
Thu, 10 Dec 2015 22:28:51 +0000 (23:28 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
src/python/pypamtest.c

index 1538294c02c42270e20c8853168866fa62e091a8..e3423665b52c32bf7a8823e7117e274bc236564e 100644 (file)
@@ -263,6 +263,11 @@ set_pypamtest_exception(PyObject *exc,
        const char *strerr;
        const struct pam_testcase *failed;
 
+       if (exc == NULL) {
+               PyErr_BadArgument();
+               return;
+       }
+
        strerr = pamtest_strerror(perr);
 
        if (perr == PAMTEST_ERR_CASE) {