libnv: correct the calculation of the structure's size

Reported by:	Milosz Kaniewski <[email protected]>
Approved by:	so
Security:	FreeBSD-SA-24:16.libnv
Security:	CVE-2024-45287

(cherry picked from commit 7f4731ab67)
(cherry picked from commit 056c50c48b)
This commit is contained in:
Mariusz Zaborski authored and Gordon Tetlow committed 2024-09-19 14:11:22 +01:00
1 parent ba46f11749
commit e9d57be06e
1 file changed
+1 -1
+1 -1
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);
}