From d75bd533f0ad534486488013eeeaa642ea1f5f58 Mon Sep 17 00:00:00 2001 From: bluhm Date: Tue, 26 Mar 2024 10:01:57 +0000 Subject: [PATCH] Avoid NULL pointer dereference in routing table an_match(). OK mvs@ --- sys/net/rtable.c | 4 ++-- 1 file 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); -- 2.20.1