From c4015db86a7e4c99ee48201c48ffa021ef6f5ed5 Mon Sep 17 00:00:00 2001 From: andre Date: Mon, 11 Sep 2006 19:56:10 +0000 Subject: Fix a NULL pointer dereference of ro->ro_rt->rt_flags by checking for the validity of ro->ro_rt first. This prevents crashing on any non-normally routed IP packet. Coverity CID: 162 (incorrectly, it was re-introduced by previous commit) --- sys/netinet/ip_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c index f37c993..2675385 100644 --- a/sys/netinet/ip_output.c +++ b/sys/netinet/ip_output.c @@ -246,7 +246,7 @@ again: * Calculate MTU. If we have a route that is up, use that, * otherwise use the interface's MTU. */ - if (ro->ro_rt->rt_flags & (RTF_UP | RTF_HOST)) { + if (ro->ro_rt != NULL && (ro->ro_rt->rt_flags & (RTF_UP|RTF_HOST))) { /* * This case can happen if the user changed the MTU * of an interface after enabling IP on it. Because -- cgit v1.1