git: 76c8f202a4f6 - main - pf: fix pf_nv##_array() size check
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 31 May 2023 16:09:06 UTC
The branch main has been updated by kp:
URL: https://cgit.FreeBSD.org/src/commit/?id=76c8f202a4f6a3190e102a0bc1589bbfc179abf6
commit 76c8f202a4f6a3190e102a0bc1589bbfc179abf6
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2023-05-15 17:40:32 +0000
Commit: Kristof Provost <kp@FreeBSD.org>
CommitDate: 2023-05-31 16:07:58 +0000
pf: fix pf_nv##_array() size check
We want to set the maximum number of elements we'll accept, not the
exact number we need.
MFC after: 3 weeks
Sponsored by: Orange Business Services
---
sys/netpfil/pf/pf_nv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sys/netpfil/pf/pf_nv.c b/sys/netpfil/pf/pf_nv.c
index 2e813bc49f9a..aefd0268dde9 100644
--- a/sys/netpfil/pf/pf_nv.c
+++ b/sys/netpfil/pf/pf_nv.c
@@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$");
if (! nvlist_exists_number_array(nvl, name)) \
return (EINVAL); \
n = nvlist_get_number_array(nvl, name, &nitems); \
- if (nitems != maxelems) \
+ if (nitems > maxelems) \
return (E2BIG); \
if (nelems != NULL) \
*nelems = nitems; \