summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2002-07-12 22:08:47 +0000
committerluigi <luigi@FreeBSD.org>2002-07-12 22:08:47 +0000
commit7cb243d2f4ee007a1b508dc2b4b1c8e98124b31a (patch)
tree66c94dd424248d11f286cc7de7511a92004b9208
parentdc5d856e710c7a79039e46c89de1624670a57c92 (diff)
downloadFreeBSD-src-7cb243d2f4ee007a1b508dc2b4b1c8e98124b31a.zip
FreeBSD-src-7cb243d2f4ee007a1b508dc2b4b1c8e98124b31a.tar.gz
Avoid dereferencing a null pointer in ro_rt.
This was always broken in HEAD (the offending statement was introduced in rev. 1.123 for HEAD, while RELENG_4 included this fix (in rev. 1.99.2.12 for RELENG_4) and I inadvertently deleted it in 1.99.2.30. So I am also restoring these two lines in RELENG_4 now. We might need another few things from 1.99.2.30.
-rw-r--r--sys/netinet/ip_output.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/netinet/ip_output.c b/sys/netinet/ip_output.c
index 3402a28..8d78163 100644
--- a/sys/netinet/ip_output.c
+++ b/sys/netinet/ip_output.c
@@ -123,7 +123,7 @@ ip_output(m0, opt, ro, flags, imo)
int hlen = sizeof (struct ip);
int len, off, error = 0;
struct sockaddr_in *dst = NULL; /* keep compiler happy */
- struct in_ifaddr *ia;
+ struct in_ifaddr *ia = NULL;
int isbroadcast, sw_csum;
struct in_addr pkt_dst;
#ifdef IPSEC
@@ -190,7 +190,8 @@ ip_output(m0, opt, ro, flags, imo)
if (args.rule != NULL) { /* dummynet already saw us */
ip = mtod(m, struct ip *);
hlen = IP_VHL_HL(ip->ip_vhl) << 2 ;
- ia = ifatoia(ro->ro_rt->rt_ifa);
+ if (ro->ro_rt)
+ ia = ifatoia(ro->ro_rt->rt_ifa);
goto sendit;
}
OpenPOWER on IntegriCloud