From: Howard Chu Date: Sat, 8 Jun 2013 21:10:08 +0000 (-0700) Subject: Make sure mdb_stat() gets valid data X-Git-Tag: OPENLDAP_REL_ENG_2_4_36~36^2~25 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bcb67dd22f06a7f7c85350bc548c50ccfc27dbaa;p=openldap Make sure mdb_stat() gets valid data --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 9e01fb5e07..a90d7d5510 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -7325,6 +7325,12 @@ int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *arg) if (txn == NULL || arg == NULL || dbi >= txn->mt_numdbs) return EINVAL; + if (txn->mt_dbflags[dbi] & DB_STALE) { + MDB_cursor mc; + MDB_xcursor mx; + /* Stale, must read the DB's root. cursor_init does it for us. */ + mdb_cursor_init(&mc, txn, dbi, &mx); + } return mdb_stat0(txn->mt_env, &txn->mt_dbs[dbi], arg); }