summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Zaborski <oshogbo@FreeBSD.org>2026-04-28 14:36:09 +0000
committerMark Johnston <markj@FreeBSD.org>2026-04-28 20:32:11 +0000
commitf7f48005fbe256e3af42db3cc5ad33b140050f03 (patch)
tree24a80c65773a0c0327875966d44967c80e126e69
parent32d12677ff45da6b3152803430990997c3f218b1 (diff)
-rw-r--r--sys/contrib/libnv/nvlist.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/contrib/libnv/nvlist.c b/sys/contrib/libnv/nvlist.c
index 6934da0df00a..721332247b38 100644
--- a/sys/contrib/libnv/nvlist.c
+++ b/sys/contrib/libnv/nvlist.c
@@ -1029,10 +1029,6 @@ static bool
nvlist_check_header(struct nvlist_header *nvlhdrp)
{
- if (nvlhdrp->nvlh_size > SIZE_MAX - sizeof(*nvlhdrp)) {
- ERRNO_SET(EINVAL);
- return (false);
- }
if (nvlhdrp->nvlh_magic != NVLIST_HEADER_MAGIC) {
ERRNO_SET(EINVAL);
return (false);
@@ -1052,6 +1048,11 @@ nvlist_check_header(struct nvlist_header *nvlhdrp)
nvlhdrp->nvlh_descriptors = be64toh(nvlhdrp->nvlh_descriptors);
}
#endif
+ if (nvlhdrp->nvlh_size > SIZE_MAX - sizeof(*nvlhdrp)) {
+ ERRNO_SET(EINVAL);
+ return (false);
+ }
+
return (true);
}