MFV r337218: 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:26:07 +00:00
commit 33bdecc5d0

View File

@ -914,6 +914,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) * 8 - 1))
return (EINVAL);
nvp_sz = NVP_SIZE_CALC(name_sz, value_sz);