mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
pf: counter argument to pfr_pool_get() may never be NULL
Coverity points out that if counter was NULL when passed to
pfr_pool_get() we could potentially end up dereferencing it.
Happily all users of the function pass a non-NULL pointer. Enforce this
by assertion and remove the pointless NULL check.
Reported by: Coverity (CID 273309)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
This commit is contained in:
parent
4302035063
commit
efc64d02a6
1 changed files with 2 additions and 1 deletions
|
|
@ -2249,6 +2249,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
|
|||
int idx = -1, use_counter = 0;
|
||||
|
||||
MPASS(pidx != NULL);
|
||||
MPASS(counter != NULL);
|
||||
|
||||
switch (af) {
|
||||
case AF_INET:
|
||||
|
|
@ -2268,7 +2269,7 @@ pfr_pool_get(struct pfr_ktable *kt, int *pidx, struct pf_addr *counter,
|
|||
return (-1);
|
||||
|
||||
idx = *pidx;
|
||||
if (counter != NULL && idx >= 0)
|
||||
if (idx >= 0)
|
||||
use_counter = 1;
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue