mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-05-28 04:35:57 -04:00
ITS#8335 LMDB: reject MDB_MULTIPLE put with 0 items
Also check for overflow of count and size.
This commit is contained in:
parent
25f9efab91
commit
0ff5b99e40
1 changed files with 9 additions and 0 deletions
|
|
@ -8505,10 +8505,19 @@ _mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data,
|
|||
* early failures.
|
||||
*/
|
||||
if (flags & MDB_MULTIPLE) {
|
||||
size_t tmp;
|
||||
if (!data[1].mv_size)
|
||||
return EINVAL;
|
||||
|
||||
dcount = data[1].mv_size;
|
||||
data[1].mv_size = 0;
|
||||
if (!F_ISSET(mc->mc_db->md_flags, MDB_DUPFIXED))
|
||||
return MDB_INCOMPATIBLE;
|
||||
|
||||
/* check for overflow */
|
||||
tmp = data[0].mv_size * dcount;
|
||||
if (tmp/dcount != data[0].mv_size)
|
||||
return MDB_BAD_VALSIZE;
|
||||
}
|
||||
|
||||
nospill = flags & MDB_NOSPILL;
|
||||
|
|
|
|||
Loading…
Reference in a new issue