From: Roy Marples Date: Sun, 12 Apr 2015 08:57:13 +0000 (+0000) Subject: Fix a segfault when finding a route without an interface. X-Git-Tag: v6.8.2~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d804f479a2b15878cdc2a8628d37cd1bd0901406;p=thirdparty%2Fdhcpcd.git Fix a segfault when finding a route without an interface. Thanks to Paul Walrath. --- diff --git a/ipv4.c b/ipv4.c index 17d22669..2e43f028 100644 --- a/ipv4.c +++ b/ipv4.c @@ -252,8 +252,8 @@ find_route(struct rt_head *rts, const struct rt *r, const struct rt *srt) TAILQ_FOREACH(rt, rts, next) { if (rt->dest.s_addr == r->dest.s_addr && #ifdef HAVE_ROUTE_METRIC - (srt || (!rt->iface || - rt->iface->metric == r->iface->metric)) && + (srt || (r->iface == NULL || rt->iface == NULL || + rt->iface->metric == r->iface->metric)) && #endif (!srt || srt != rt) && rt->net.s_addr == r->net.s_addr)