summaryrefslogtreecommitdiffstats
path: root/sbin/routed
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2016-05-14 23:07:26 +0000
committerpfg <pfg@FreeBSD.org>2016-05-14 23:07:26 +0000
commita45e6b4c6f8a503a4727e4949ae32e19864f96e8 (patch)
treee955b0f334ad76069d87f35fd787442dbb83541d /sbin/routed
parentfe72dd1b411d4a3344d64b7e90ab0fbaff92829e (diff)
downloadFreeBSD-src-a45e6b4c6f8a503a4727e4949ae32e19864f96e8.zip
FreeBSD-src-a45e6b4c6f8a503a4727e4949ae32e19864f96e8.tar.gz
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
Diffstat (limited to 'sbin/routed')
-rw-r--r--sbin/routed/if.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sbin/routed/if.c b/sbin/routed/if.c
index fadb9af..b59186a 100644
--- a/sbin/routed/if.c
+++ b/sbin/routed/if.c
@@ -955,6 +955,7 @@ ifinit(void)
(intmax_t)now.tv_sec -
ifp->int_data.ts);
ifdel(ifp);
+ ifp = NULL;
}
continue;
}
@@ -1151,7 +1152,7 @@ ifinit(void)
/* If we are multi-homed, optionally advertise a route to
* our main address.
*/
- if (advertise_mhome
+ if ((advertise_mhome && ifp)
|| (tot_interfaces > 1
&& mhome
&& (ifp = ifwithaddr(myaddr, 0, 0)) != NULL
OpenPOWER on IntegriCloud