libnv: correct the calculation of the structure's size

Reported by:	Milosz Kaniewski <milosz.kaniewski@gmail.com>

(cherry picked from commit 7f4731ab67f1d3345aee6626eb83cc5ce00010f0)
This commit is contained in:
Mariusz Zaborski 2024-09-11 16:43:43 +02:00 committed by Ed Maste
parent 0481321926
commit 056c50c48b

View file

@ -1029,7 +1029,7 @@ static bool
nvlist_check_header(struct nvlist_header *nvlhdrp)
{
if (nvlhdrp->nvlh_size > SIZE_MAX - sizeof(nvlhdrp)) {
if (nvlhdrp->nvlh_size > SIZE_MAX - sizeof(*nvlhdrp)) {
ERRNO_SET(EINVAL);
return (false);
}