From: Howard Chu Date: Fri, 1 Feb 2013 14:19:23 +0000 (-0800) Subject: NULL key is allowed for MDB_CURRENT X-Git-Tag: OPENLDAP_REL_ENG_2_4_34~3^2~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=744e31193913d117a68414fe163c9038a78edde2;p=openldap NULL key is allowed for MDB_CURRENT --- diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 578e6b6979..36b02a3452 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -1095,6 +1095,10 @@ mdb_dkey(MDB_val *key, char *buf) char *ptr = buf; unsigned char *c = key->mv_data; unsigned int i; + + if (!key) + return ""; + if (key->mv_size > MDB_MAXKEYSIZE) return "MDB_MAXKEYSIZE"; /* may want to make this a dynamic check: if the key is mostly @@ -4823,7 +4827,7 @@ mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data, if (F_ISSET(mc->mc_txn->mt_flags, MDB_TXN_RDONLY)) return EACCES; - if (key->mv_size == 0 || key->mv_size > MDB_MAXKEYSIZE) + if (flags != MDB_CURRENT && (key->mv_size == 0 || key->mv_size > MDB_MAXKEYSIZE)) return EINVAL; if (F_ISSET(mc->mc_db->md_flags, MDB_DUPSORT) && data->mv_size > MDB_MAXKEYSIZE)