git: 5162690ed3cf - main - pf: handle anchor or anchor_call not being passed in PFNL_CMD_ADDRULE

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Mon, 23 Nov 2026 18:11:51 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=5162690ed3cf91757614b89819d3bf3d7ec806a1

commit 5162690ed3cf91757614b89819d3bf3d7ec806a1
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2026-11-20 09:46:51 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2026-11-23 17:17:12 +0000

    pf: handle anchor or anchor_call not being passed in PFNL_CMD_ADDRULE
    
    Reported by:    Kevin Day <kevin@your.org>
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/pf/pf_ioctl.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c
index 764e48890e57..41c6641647ad 100644
--- a/sys/netpfil/pf/pf_ioctl.c
+++ b/sys/netpfil/pf/pf_ioctl.c
@@ -3014,6 +3014,9 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket,
 #define	ERROUT(x)		ERROUT_FUNCTION(errout, x)
 #define	ERROUT_UNLOCKED(x)	ERROUT_FUNCTION(errout_unlocked, x)
 
+	if (anchor == NULL || anchor_call == NULL)
+		ERROUT_UNLOCKED(EINVAL);
+
 	if ((rule->return_icmp >> 8) > ICMP_MAXTYPE)
 		ERROUT_UNLOCKED(EINVAL);