7261 nvlist code should enforce name length limit

illumos/illumos-gate@48dd5e630c

Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Matthew Ahrens <mahrens@delphix.com>
This commit is contained in:
Alexander Motin 2018-08-03 01:17:14 +00:00
parent cffb58bd7c
commit 1b47c2b7e5

View File

@ -910,6 +910,8 @@ nvlist_add_common(nvlist_t *nvl, const char *name,
/* calculate sizes of the nvpair elements and the nvpair itself */
name_sz = strlen(name) + 1;
if (name_sz >= 1ULL << (sizeof (nvp->nvp_name_sz) * NBBY - 1))
return (EINVAL);
nvp_sz = NVP_SIZE_CALC(name_sz, value_sz);