NULL key is allowed for MDB_CURRENT

vmware
Howard Chu 12 years ago
parent 48dc782ea6
commit 744e311939
  1. 6
      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)

Loading…
Cancel
Save