summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bluhm <bluhm@cvs.openbsd.org>2024-03-26 10:01:58 +0000
committerAlexander Bluhm <bluhm@cvs.openbsd.org>2024-03-26 10:01:58 +0000
commitf8501236c8874fa6ac674b6550e12b7945636e9b (patch)
tree5932d9f06dd581601ae598c7f3ae7d2852df50df
parentffc6203fb8b39616fb38cce936a03cf90dcc16c2 (diff)
Avoid NULL pointer dereference in routing table an_match().
OK mvs@
-rw-r--r--sys/net/rtable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/rtable.c b/sys/net/rtable.c
index 38282ebd77e..48108ce025c 100644
--- a/sys/net/rtable.c
+++ b/sys/net/rtable.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtable.c,v 1.85 2023/11/12 17:51:40 bluhm Exp $ */
+/* $OpenBSD: rtable.c,v 1.86 2024/03/26 10:01:57 bluhm Exp $ */
/*
* Copyright (c) 2014-2016 Martin Pieuchot
@@ -875,7 +875,7 @@ an_match(struct art_node *an, const struct sockaddr *dst, int plen)
return (0);
rt = SRPL_FIRST(&sr, &an->an_rtlist);
- match = (memcmp(rt->rt_dest, dst, dst->sa_len) == 0);
+ match = (rt != NULL && memcmp(rt->rt_dest, dst, dst->sa_len) == 0);
SRPL_LEAVE(&sr);
return (match);