routed: Fix use after free.
For the multihomed case, ifp be used after being freed. NULL the value after freeing it and avoid getting into the branch without reassigning a new value. CID: 272671 Obtained from: NetBSD MFC after: 2 weeks
This commit is contained in:
parent
54811dda50
commit
0b279f8c94
@ -955,6 +955,7 @@ ifinit(void)
|
|||||||
(intmax_t)now.tv_sec -
|
(intmax_t)now.tv_sec -
|
||||||
ifp->int_data.ts);
|
ifp->int_data.ts);
|
||||||
ifdel(ifp);
|
ifdel(ifp);
|
||||||
|
ifp = NULL;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -1151,7 +1152,7 @@ ifinit(void)
|
|||||||
/* If we are multi-homed, optionally advertise a route to
|
/* If we are multi-homed, optionally advertise a route to
|
||||||
* our main address.
|
* our main address.
|
||||||
*/
|
*/
|
||||||
if (advertise_mhome
|
if ((advertise_mhome && ifp)
|
||||||
|| (tot_interfaces > 1
|
|| (tot_interfaces > 1
|
||||||
&& mhome
|
&& mhome
|
||||||
&& (ifp = ifwithaddr(myaddr, 0, 0)) != NULL
|
&& (ifp = ifwithaddr(myaddr, 0, 0)) != NULL
|
||||||
|
Loading…
x
Reference in New Issue
Block a user