]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
catch invalid read (i == -1)
authorPierangelo Masarati <ando@openldap.org>
Mon, 18 Dec 2006 01:28:43 +0000 (01:28 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 18 Dec 2006 01:28:43 +0000 (01:28 +0000)
servers/slapd/modify.c

index 826219c4c09e05b3110f9f53da6621371dd6af9a..3a4e6e70aec2afc1027828fbecfe1414a8d2ec8c 100644 (file)
@@ -901,16 +901,17 @@ int slap_mods_check(
                                        }
                                }
 done:
-                               j = ix[i];
                                slap_sl_free( ix, ctx );
 
                                if ( rc != LDAP_SUCCESS ) {
                                        return rc;
                                } else if ( match == 0 ) {
                                        /* value exists already */
+                                       assert( i >= 0 );
+                                       assert( i < nvals );
                                        snprintf( textbuf, textlen,
                                                "%s: value #%d provided more than once",
-                                               ml->sml_desc->ad_cname.bv_val, j );
+                                               ml->sml_desc->ad_cname.bv_val, ix[i] );
                                        *text = textbuf;
                                        return LDAP_TYPE_OR_VALUE_EXISTS;
                                }