amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0060-Ticket-47988-Schema-learning-mechanism-in-replicatio.patch

f92ce9
From 602e9ef126808491be5d33d9c4faa9c86e63730a Mon Sep 17 00:00:00 2001
f92ce9
From: Noriko Hosoi <nhosoi@redhat.com>
f92ce9
Date: Sun, 25 Jan 2015 22:05:12 -0800
f92ce9
Subject: [PATCH] Ticket 47988: Schema learning mechanism, in replication,
f92ce9
 unable to extend an existing definition
f92ce9
f92ce9
Description: Covscan FORWARD_NULL fix introduced by commit
f92ce9
commit 51e05df9c37c66206041f026c9a67ec17bc9ea4a
f92ce9
f92ce9
1. ldap/servers/slapd/schema.c:2490: var_deref_op: Dereferencing null pointer "mod->mod_vals.modv_bvals".
f92ce9
2. ldap/servers/slapd/schema.c:2603: var_deref_op: Dereferencing null pointer "mod->mod_vals.modv_bvals".
f92ce9
f92ce9
Added NULL check on mod->mod_bvalues to the for loop stop condition.
f92ce9
f92ce9
(cherry picked from commit cfa8e4daef9253df0bd8a348f302299bda16b37c)
f92ce9
(cherry picked from commit 1e2bf2b1ee6cd4c08a171edfedb10ee6bb1c3420)
f92ce9
---
f92ce9
 ldap/servers/slapd/schema.c | 4 ++--
f92ce9
 1 file changed, 2 insertions(+), 2 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/servers/slapd/schema.c b/ldap/servers/slapd/schema.c
f92ce9
index 05329a6..a251aa7 100644
f92ce9
--- a/ldap/servers/slapd/schema.c
f92ce9
+++ b/ldap/servers/slapd/schema.c
f92ce9
@@ -2487,7 +2487,7 @@ schema_delete_objectclasses( Slapi_Entry *entryBefore, LDAPMod *mod,
f92ce9
 	}
f92ce9
   }
f92ce9
 
f92ce9
-  for (i = 0; mod->mod_bvalues[i]; i++) {
f92ce9
+  for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) {
f92ce9
 	if ( LDAP_SUCCESS != ( rc = parse_oc_str (
f92ce9
 				(const char *)mod->mod_bvalues[i]->bv_val, &delete_oc,
f92ce9
 				errorbuf, errorbufsize, 0, 0, schema_ds4x_compat, NULL))) {
f92ce9
@@ -2600,7 +2600,7 @@ schema_delete_attributes ( Slapi_Entry *entryBefore, LDAPMod *mod,
f92ce9
 	  }
f92ce9
   }
f92ce9
 
f92ce9
-  for (i = 0; mod->mod_bvalues[i]; i++) {
f92ce9
+  for (i = 0; mod->mod_bvalues && mod->mod_bvalues[i]; i++) {
f92ce9
 	attr_ldif =(char *)  mod->mod_bvalues[i]->bv_val;
f92ce9
 
f92ce9
 	/* normalize the attr ldif */
f92ce9
-- 
f92ce9
1.9.3
f92ce9