]> git.sur5r.net Git - openldap/commitdiff
ITS#8347 fix off-by-one in VL32 purge
authorHoward Chu <hyc@openldap.org>
Mon, 11 Jan 2016 20:25:33 +0000 (20:25 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 11 Jan 2016 20:25:33 +0000 (20:25 +0000)
libraries/liblmdb/mdb.c

index bd129c4c2d5494ad6035c73e57513a16ed1427dd..1991f01da3b32a53774470414d180e2e0e393b32 100644 (file)
@@ -5766,7 +5766,7 @@ notlocal:
                pthread_mutex_lock(&env->me_rpmutex);
 retry:
                y = 0;
-               for (i=1; i<tl[0].mid; i++) {
+               for (i=1; i<=tl[0].mid; i++) {
                        if (!tl[i].mref) {
                                if (!y) y = i;
                                /* tmp overflow pages don't go to env */
@@ -5846,7 +5846,7 @@ retry:
                if (el[0].mid >= MDB_ERPAGE_MAX - env->me_rpcheck) {
                        /* purge unref'd pages */
                        unsigned i, y = 0;
-                       for (i=1; i<el[0].mid; i++) {
+                       for (i=1; i<=el[0].mid; i++) {
                                if (!el[i].mref) {
                                        if (!y) y = i;
                                        munmap(el[i].mptr, env->me_psize * el[i].mcnt);