summaryrefslogtreecommitdiffstats
path: root/usr.sbin/rtadvd
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2011-07-04 03:19:06 +0000
committerhrs <hrs@FreeBSD.org>2011-07-04 03:19:06 +0000
commitc74259338a3a1c2e0c9a2f8831667786a5281518 (patch)
tree8bdd2c90bb7e90495334c07b73c8696a01093e8f /usr.sbin/rtadvd
parent5acd1abd93fcf6f4c05ad68a4ffddb284a4594fa (diff)
downloadFreeBSD-src-c74259338a3a1c2e0c9a2f8831667786a5281518.zip
FreeBSD-src-c74259338a3a1c2e0c9a2f8831667786a5281518.tar.gz
Add sanity check for ifm_version in struct if_msghdr.
Diffstat (limited to 'usr.sbin/rtadvd')
-rw-r--r--usr.sbin/rtadvd/if.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c
index 302c334..8722a05 100644
--- a/usr.sbin/rtadvd/if.c
+++ b/usr.sbin/rtadvd/if.c
@@ -105,6 +105,12 @@ if_nametosdl(char *name)
lim = buf + len;
for (next = buf; next < lim; next += ifm->ifm_msglen) {
ifm = (struct if_msghdr *)next;
+ if (ifm->ifm_version != RTM_VERSION) {
+ syslog(LOG_ERR,
+ "<%s> RTM_VERSION mismatch (%d != %d).",
+ __func__, ifm->ifm_version, RTM_VERSION);
+ continue;
+ }
if (ifm->ifm_type == RTM_IFINFO) {
sa = (struct sockaddr *)(ifm + 1);
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
OpenPOWER on IntegriCloud