1
0
Эх сурвалжийг харах

Bug 611790 - fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166

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

Resolves: bug 611790
Bug description: Fix coverify Defect Type: Null pointer dereferences issues 11940 - 12166
Fix description: Catch possible NULL pointer in cos_cache_add_defn().
Note: committing the fix on behalf of Endi ([email protected]).
Noriko Hosoi 15 жил өмнө
parent
commit
e4808ae72c

+ 10 - 2
ldap/servers/plugins/cos/cos_cache.c

@@ -1387,10 +1387,18 @@ static int cos_cache_add_defn(
 	cosAttrValue *pDummyAttrVal = 0;
 	cosAttrValue *pAttrsIter = 0;
 	cosAttributes *pDummyAttributes = 0;
-	cosAttrValue *pSpecsIter = *spec;
+	cosAttrValue *pSpecsIter = 0;
 
 	LDAPDebug( LDAP_DEBUG_TRACE, "--> cos_cache_add_defn\n",0,0,0);
 	
+	if (!spec) {
+		LDAPDebug( LDAP_DEBUG_ANY, "missing spec\n",0,0,0);
+		ret = -1;
+		goto out;
+	}
+
+	pSpecsIter = *spec;
+
 	/* we don't want cosspecifiers that can be supplied by the same scheme */
 	while( pSpecsIter )
 	{
@@ -1481,7 +1489,7 @@ static int cos_cache_add_defn(
 			ret = -1;
 		}
 	}
-
+out:
 	if(ret < 0)
 	{
 		if(dn)