]> git.sur5r.net Git - openldap/commitdiff
ITS#7146 fix prev commit
authorHoward Chu <hyc@openldap.org>
Thu, 2 Feb 2012 11:26:53 +0000 (03:26 -0800)
committerHoward Chu <hyc@openldap.org>
Thu, 2 Feb 2012 11:26:53 +0000 (03:26 -0800)
servers/slapd/back-mdb/attr.c
servers/slapd/back-mdb/id2entry.c

index e57c5d7145b929c7adcec22cc6e0b5e2d8276d23..8faf17a59cbb03e4783c198e2e23328ea8efde55 100644 (file)
@@ -556,6 +556,12 @@ int mdb_ad_read( struct mdb_info *mdb, MDB_txn *txn )
                if ( rc ) {
                        rc = slap_bv2undef_ad( &bdata, &mdb->mi_ads[i], &text, 0 );
                } else {
+                       if ( ad->ad_index >= MDB_MAXADS ) {
+                               Debug( LDAP_DEBUG_ANY,
+                                       "mdb_adb_read: too many AttributeDescriptions in use\n",
+                                       0, 0, 0 );
+                               return LDAP_OTHER;
+                       }
                        mdb->mi_adxs[ad->ad_index] = i;
                        mdb->mi_ads[i] = ad;
                }
index cdc2e051a2a1b742949be677ecbcefe72e2b24d0..863ccf6c1f0d58d57eb07d146c914fcf551b5de5 100644 (file)
@@ -500,6 +500,11 @@ static int mdb_entry_partsize(struct mdb_info *mdb, MDB_txn *txn, Entry *e,
        for (a=e->e_attrs; a; a=a->a_next) {
                /* For AttributeDesc, we only store the attr index */
                nat++;
+               if (a->a_desc->ad_index >= MDB_MAXADS) {
+                       Debug( LDAP_DEBUG_ANY, "mdb_entry_partsize: too many AttributeDescriptions used\n",
+                               0, 0, 0 );
+                       return LDAP_OTHER;
+               }
                if (!mdb->mi_adxs[a->a_desc->ad_index]) {
                        int rc = mdb_ad_get(mdb, txn, a->a_desc);
                        if (rc)
@@ -569,11 +574,6 @@ 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)