Browse Source

Bug 750625 - Fix Coverity (11064) Dereference before null check

https://bugzilla.redhat.com/show_bug.cgi?id=750625

slapd/pw_retry.c (get_entry)

Bug Description: Dereferencing pointer "pb" before a null check.

Fix Description: Check if "pb" is NULL or not first.  If NULL,
goto bail.
Noriko Hosoi 14 years ago
parent
commit
938046cc40
1 changed files with 7 additions and 1 deletions
  1. 7 1
      ldap/servers/slapd/pw_retry.c

+ 7 - 1
ldap/servers/slapd/pw_retry.c

@@ -209,9 +209,15 @@ Slapi_Entry *get_entry ( Slapi_PBlock *pb, const char *dn)
 	Slapi_DN        *target_sdn = NULL;
 	Slapi_DN        sdn;
 
+	if (NULL == pb) {
+		LDAPDebug(LDAP_DEBUG_ANY, "get_entry - no pblock specified.\n",
+		          0, 0, 0);
+		goto bail;
+	}
+
 	slapi_pblock_get( pb, SLAPI_TARGET_SDN, &target_sdn );
 
-	if ((dn == NULL) && pb) {
+	if (dn == NULL) {
 		dn = slapi_sdn_get_dn(target_sdn);
 	}