]> git.sur5r.net Git - openldap/commitdiff
ITS#1570 - avoid overflowing array when dups are present in IDLs
authorHoward Chu <hyc@openldap.org>
Thu, 11 Apr 2002 08:01:56 +0000 (08:01 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 11 Apr 2002 08:01:56 +0000 (08:01 +0000)
servers/slapd/back-ldbm/idl.c

index 48a0b65f699b97548d195e6b1e3e859e029ef27a..011a01a3be3d9a0828c209f6e406f38e47d9505b 100644 (file)
@@ -1067,6 +1067,9 @@ idl_intersection(
 #endif
 
        for ( ni = 0, ai = 0, bi = 0; ai < ID_BLOCK_NIDS(a); ai++ ) {
+               if ( ID_BLOCK_ID(a, ai) < ID_BLOCK_ID(b, bi) ) {
+                       continue;
+               }
                for ( ;
                        bi < ID_BLOCK_NIDS(b) && ID_BLOCK_ID(b, bi) < ID_BLOCK_ID(a, ai);
                        bi++ )
@@ -1080,6 +1083,7 @@ idl_intersection(
 
                if ( ID_BLOCK_ID(b, bi) == ID_BLOCK_ID(a, ai) ) {
                        ID_BLOCK_ID(n, ni++) = ID_BLOCK_ID(a, ai);
+                       bi++;
                }
        }