summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandre <andre@FreeBSD.org>2006-09-11 19:56:10 +0000
committerandre <andre@FreeBSD.org>2006-09-11 19:56:10 +0000
commitc4015db86a7e4c99ee48201c48ffa021ef6f5ed5 (patch)
tree34bec235133334439296f45ec0e8523b7fe53360
parent320be4d7621ff6087c57d04e2811b302cb44eb92 (diff)
downloadFreeBSD-src-c4015db86a7e4c99ee48201c48ffa021ef6f5ed5.zip
FreeBSD-src-c4015db86a7e4c99ee48201c48ffa021ef6f5ed5.tar.gz
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)
-rw-r--r--sys/netinet/ip_output.c2
1 files changed, 1 insertions, 1 deletions
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
OpenPOWER on IntegriCloud