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)
This commit is contained in:
andre 2006-09-11 19:56:10 +00:00
parent 320be4d762
commit c4015db86a

View File

@ -246,7 +246,7 @@ ip_output(struct mbuf *m, struct mbuf *opt, struct route *ro,
* 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