summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMathieu Sauve-Frankel <msf@cvs.openbsd.org>2004-07-22 23:21:11 +0000
committerMathieu Sauve-Frankel <msf@cvs.openbsd.org>2004-07-22 23:21:11 +0000
commitb7542ee629baaaf121e890fd6abc9a2270c77a1a (patch)
treec41b85fd7081ac664b2a6441f1492deef708f27f /sys
parentc20a38f0343b175356aa85e60b74743eb9862bfa (diff)
Add missing check for NULL in DIOCCHANGERULE. This prevents a crash in
certain rare cases. ok mcbride@ dhartmei@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/pf_ioctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c
index c8a5704e68c..0278de8c19c 100644
--- a/sys/net/pf_ioctl.c
+++ b/sys/net/pf_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_ioctl.c,v 1.128 2004/07/05 00:15:20 henning Exp $ */
+/* $OpenBSD: pf_ioctl.c,v 1.129 2004/07/22 23:21:10 msf Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -1420,7 +1420,8 @@ pfioctl(dev_t dev, u_long cmd, caddr_t addr, int flags, struct proc *p)
while ((oldrule != NULL) && (oldrule->nr != pcr->nr))
oldrule = TAILQ_NEXT(oldrule, entries);
if (oldrule == NULL) {
- pf_rm_rule(NULL, newrule);
+ if (newrule != NULL)
+ pf_rm_rule(NULL, newrule);
error = EINVAL;
splx(s);
break;