summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2020-10-21 11:36:56 +0000
committermpi <mpi@openbsd.org>2020-10-21 11:36:56 +0000
commit7f6d2eb851330fdb9df4f2252f145ff33dc1ef35 (patch)
treedddc3d04a3a633f23636d20c0497bba5b6377b15
parentICMP raw sockets start to receive packets as soon as they are created (diff)
downloadwireguard-openbsd-7f6d2eb851330fdb9df4f2252f145ff33dc1ef35.tar.xz
wireguard-openbsd-7f6d2eb851330fdb9df4f2252f145ff33dc1ef35.zip
Prevent NULL dereference introduced in previous.
Used a different variable to not shadow `entry' allocated before grabbing the lock.
-rw-r--r--sys/net/pf_osfp.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/net/pf_osfp.c b/sys/net/pf_osfp.c
index 67541381500..614baecf1a6 100644
--- a/sys/net/pf_osfp.c
+++ b/sys/net/pf_osfp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pf_osfp.c,v 1.41 2020/10/21 08:08:04 sashan Exp $ */
+/* $OpenBSD: pf_osfp.c,v 1.42 2020/10/21 11:36:56 mpi Exp $ */
/*
* Copyright (c) 2003 Mike Frantzen <frantzen@w4g.org>
@@ -375,8 +375,10 @@ pf_osfp_add(struct pf_osfp_ioctl *fpioc)
NET_LOCK();
PF_LOCK();
if ((fp = pf_osfp_find_exact(&pf_osfp_list, &fpadd))) {
- SLIST_FOREACH(entry, &fp->fp_oses, fp_entry) {
- if (PF_OSFP_ENTRY_EQ(entry, &fpioc->fp_os)) {
+ struct pf_osfp_entry *tentry;
+
+ SLIST_FOREACH(tentry, &fp->fp_oses, fp_entry) {
+ if (PF_OSFP_ENTRY_EQ(tentry, &fpioc->fp_os)) {
NET_UNLOCK();
PF_UNLOCK();
pool_put(&pf_osfp_entry_pl, entry);