git: 5fc8fe3df5b9 - main - libpfctl: Fix the counts returned by pfctl_ina_define()

From: R. Christian McDonald <rcm_at_FreeBSD.org>
Date: Sun, 11 Oct 2026 14:47:36 UTC
The branch main has been updated by rcm:

URL: https://cgit.FreeBSD.org/src/commit/?id=5fc8fe3df5b9ede9e1cc1e35a0d10e6390b030d9

commit 5fc8fe3df5b9ede9e1cc1e35a0d10e6390b030d9
Author:     R. Christian McDonald <rcm@FreeBSD.org>
AuthorDate: 2026-10-11 14:46:41 +0000
Commit:     R. Christian McDonald <rcm@FreeBSD.org>
CommitDate: 2026-10-11 14:47:10 +0000

    libpfctl: Fix the counts returned by pfctl_ina_define()
    
    The counts of a table definition were stored only if the caller's
    variables already held a non-zero value, and read uninitialised ones
    otherwise.  pfctl_ina_define() passes the address of two uninitialised
    locals and sums them up.
    
    Reviewed by:            kp
    Fixes:                  219ce3063840 ("pf: convert DIOCRINADEFINE to netlink")
    Sponsored by:           Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D60614
---
 lib/libpfctl/libpfctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libpfctl/libpfctl.c b/lib/libpfctl/libpfctl.c
index 097c4743da2c..16a6ce8c7702 100644
--- a/lib/libpfctl/libpfctl.c
+++ b/lib/libpfctl/libpfctl.c
@@ -4079,9 +4079,9 @@ _pfctl_ina_define(struct pfctl_handle *h, struct pfr_table *tbl,
 			continue;
 	}
 
-	if (*nadd)
+	if (nadd)
 		*nadd = attrs.nadd;
-	if (*naddr)
+	if (naddr)
 		*naddr = attrs.naddr;
 
 out: