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
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)