git: 7f4731ab67f1 - main - libnv: correct the calculation of the structure's size

From: Mariusz Zaborski <oshogbo_at_FreeBSD.org>
Date: Wed, 11 Sep 2024 14:45:01 UTC
The branch main has been updated by oshogbo:

URL: https://cgit.FreeBSD.org/src/commit/?id=7f4731ab67f1d3345aee6626eb83cc5ce00010f0

commit 7f4731ab67f1d3345aee6626eb83cc5ce00010f0
Author:     Mariusz Zaborski <oshogbo@FreeBSD.org>
AuthorDate: 2024-09-11 14:43:43 +0000
Commit:     Mariusz Zaborski <oshogbo@FreeBSD.org>
CommitDate: 2024-09-11 14:43:43 +0000

    libnv: correct the calculation of the structure's size
    
    Reported by:    Milosz Kaniewski <milosz.kaniewski@gmail.com>
---
 sys/contrib/libnv/nvlist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c
index 1dc0bb8c1141..00ba3b41f3a3 100644
--- a/sys/contrib/libnv/nvlist.c
+++ b/sys/contrib/libnv/nvlist.c
@@ -1022,7 +1022,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);
 	}