summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2010-07-02 00:31:44 -0500
committerNoriko Hosoi <nhosoi@redhat.com>2010-08-23 11:07:37 -0700
commitc606cfcecb3d3403dfd3d1a90bd1d2b061eb3b6e (patch)
tree10c1e560c465477706c49583d2b74b7ce3263f84 /lib
parent9020d0a1ba5766ae40d0aefe8b4b46e0e6903ee6 (diff)
downloadds-c606cfcecb3d3403dfd3d1a90bd1d2b061eb3b6e.tar.gz
ds-c606cfcecb3d3403dfd3d1a90bd1d2b061eb3b6e.tar.xz
ds-c606cfcecb3d3403dfd3d1a90bd1d2b061eb3b6e.zip
Bug 610119 - fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199
https://bugzilla.redhat.com/show_bug.cgi?id=610119 Resolves: bug 610119 Bug description: Fix coverify Defect Type: Null pointer dereferences issues 12167 - 12199 Fix description: Catch possible NULL pointer in acl_usr_cache_insert().
Diffstat (limited to 'lib')
-rw-r--r--lib/libaccess/usrcache.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/libaccess/usrcache.cpp b/lib/libaccess/usrcache.cpp
index b0ba35fd..181edfdc 100644
--- a/lib/libaccess/usrcache.cpp
+++ b/lib/libaccess/usrcache.cpp
@@ -363,6 +363,11 @@ int acl_usr_cache_insert (const char *uid, const char *dbname,
PRCList *tail = PR_LIST_TAIL(usrobj_list);
usrobj = USEROBJ_PTR(tail);
+ if (!usrobj) {
+ rv = LAS_EVAL_FAIL;
+ goto out;
+ }
+
/* If the removed usrobj is in the hashtable, remove it from there */
if (usrobj->hashtable) {
PR_HashTableRemove(usrobj->hashtable, usrobj);
@@ -393,18 +398,11 @@ int acl_usr_cache_insert (const char *uid, const char *dbname,
PR_REMOVE_LINK(&usrobj->list);
PR_INSERT_AFTER(&usrobj->list, usrobj_list);
- /* Set the time in the UserCacheObj */
- if (usrobj) {
- rv = LAS_EVAL_TRUE;
- }
- else {
- rv = LAS_EVAL_FAIL;
- }
-
DBG_PRINT4("acl_usr_cache_insert: derCert = \"%s\" uid = \"%s\" at time = %ld\n",
usrobj->derCert ? (char *)usrobj->derCert->data : "<NONE>",
uid, time);
+out:
user_hash_crit_exit();
return rv;
}