Fix mdb_cursor_count, reject uninit'd cursor

vl32
Howard Chu 10 years ago
parent fcb0768e7d
commit 58e9c3add8
  1. 3
      libraries/liblmdb/mdb.c

@ -6989,6 +6989,9 @@ mdb_cursor_count(MDB_cursor *mc, size_t *countp)
if (mc->mc_txn->mt_flags & MDB_TXN_ERROR) if (mc->mc_txn->mt_flags & MDB_TXN_ERROR)
return MDB_BAD_TXN; return MDB_BAD_TXN;
if (!(mc->mc_flags & C_INITIALIZED))
return EINVAL;
leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]);
if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) {
*countp = 1; *countp = 1;

Loading…
Cancel
Save