]> git.sur5r.net Git - openldap/commitdiff
ITS#7146 check for ad_index overflow
authorHoward Chu <hyc@openldap.org>
Thu, 2 Feb 2012 11:08:33 +0000 (03:08 -0800)
committerHoward Chu <hyc@openldap.org>
Thu, 2 Feb 2012 11:08:33 +0000 (03:08 -0800)
Temporary fix...

servers/slapd/back-mdb/id2entry.c

index 40f816d2ac8224872616f0660a76cd4bce1529ff..cdc2e051a2a1b742949be677ecbcefe72e2b24d0 100644 (file)
@@ -569,6 +569,11 @@ static int mdb_entry_encode(Operation *op, Entry *e, MDB_val *data, Ecount *eh)
        ptr = (unsigned char *)(lp + eh->offset);
 
        for (a=e->e_attrs; a; a=a->a_next) {
+               if (a->a_desc->ad_index >= MDB_MAXADS) {
+                       Debug( LDAP_DEBUG_ANY, "mdb_entry_encode: too many AttributeDescriptions used\n",
+                               0, 0, 0 );
+                       return LDAP_OTHER;
+               }
                *lp++ = mdb->mi_adxs[a->a_desc->ad_index];
                l = a->a_numvals;
                if (a->a_nvals != a->a_vals)