From 22c18d0c444f7c03ec95d5b4a6c508f2ddec0a87 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Tue, 4 Sep 2007 02:38:34 +0000
Subject: [PATCH] make sure n,o are non-zero, so j is initialized (coverity)

---
 servers/slapd/syncrepl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index af5b81d446..db87e5205c 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -2695,6 +2695,11 @@ attr_cmp( Operation *op, Attribute *old, Attribute *new,
 		for ( o=0; old->a_vals[o].bv_val; o++ ) ;
 		for ( n=0; new->a_vals[n].bv_val; n++ ) ;
 
+		/* there MUST be both onld and new values
+		 * (otherwise j is used uninitialized) */
+		assert( o != 0 );
+		assert( n != 0 );
+
 		adds = op->o_tmpalloc( sizeof(struct berval *) * n, op->o_tmpmemctx );
 		dels = op->o_tmpalloc( sizeof(struct berval *) * o, op->o_tmpmemctx );
 
-- 
GitLab