Browse Source

Ticket 47988: Schema learning mechanism, in replication, unable to extend an existing definition

Description: Covscan FORWARD_NULL fix introduced by commit
commit 51e05df9c37c66206041f026c9a67ec17bc9ea4a

1. ldap/servers/slapd/schema.c:2490: var_deref_op: Dereferencing null pointer "mod->mod_vals.modv_bvals".
2. ldap/servers/slapd/schema.c:2603: var_deref_op: Dereferencing null pointer "mod->mod_vals.modv_bvals".

Added NULL check on mod->mod_bvalues to the for loop stop condition.
Noriko Hosoi 11 years ago
parent
commit
cfa8e4daef
1 changed files with 2 additions and 2 deletions
  1. 2 2
      ldap/servers/slapd/schema.c

+ 2 - 2
ldap/servers/slapd/schema.c

@@ -2487,7 +2487,7 @@ schema_delete_objectclasses( Slapi_Entry *entryBefore, LDAPMod *mod,
 	}
   }
 
-  for (i = 0; mod->mod_bvalues[i]; i++) {
+  for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) {
 	if ( LDAP_SUCCESS != ( rc = parse_oc_str (
 				(const char *)mod->mod_bvalues[i]->bv_val, &delete_oc,
 				errorbuf, errorbufsize, 0, 0, schema_ds4x_compat, NULL))) {
@@ -2600,7 +2600,7 @@ schema_delete_attributes ( Slapi_Entry *entryBefore, LDAPMod *mod,
 	  }
   }
 
-  for (i = 0; mod->mod_bvalues[i]; i++) {
+  for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) {
 	attr_ldif =(char *)  mod->mod_bvalues[i]->bv_val;
 
 	/* normalize the attr ldif */