summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandr Nedvedicky <sashan@cvs.openbsd.org>2019-07-11 09:39:53 +0000
committerAlexandr Nedvedicky <sashan@cvs.openbsd.org>2019-07-11 09:39:53 +0000
commit1a573569ea70e513313b755f0a0a10c614f8de81 (patch)
treeafb2ce87a891453c3fc5cd7a610a9d18d95ab0c7
parentcf85fb13be10249c026a4dc746cda1b97a841ad5 (diff)
fix NULL pointer dereference, reported and fix tested by sthen
ok yasuoka
-rw-r--r--sys/net/pf.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/pf.c b/sys/net/pf.c
index 26c3d420254..b0e6a4b5352 100644
--- a/sys/net/pf.c
+++ b/sys/net/pf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf.c,v 1.1084 2019/07/09 11:30:19 yasuoka Exp $ */
+/* $OpenBSD: pf.c,v 1.1085 2019/07/11 09:39:52 sashan Exp $ */
/*
* Copyright (c) 2001 Daniel Hartmeier
@@ -586,10 +586,12 @@ pf_insert_src_node(struct pf_src_node **sn, struct pf_rule *rule,
}
(*sn)->creation = time_uptime;
(*sn)->rule.ptr->src_nodes++;
- (*sn)->kif = kif;
+ if (kif != NULL) {
+ (*sn)->kif = kif;
+ pfi_kif_ref(kif, PFI_KIF_REF_SRCNODE);
+ }
pf_status.scounters[SCNT_SRC_NODE_INSERT]++;
pf_status.src_nodes++;
- pfi_kif_ref(kif, PFI_KIF_REF_SRCNODE);
} else {
if (rule->max_src_states &&
(*sn)->states >= rule->max_src_states) {