svn commit: r223752 - head/usr.sbin/rtadvd

Hiroki Sato hrs at FreeBSD.org
Mon Jul 4 03:19:06 UTC 2011


Author: hrs
Date: Mon Jul  4 03:19:06 2011
New Revision: 223752
URL: http://svn.freebsd.org/changeset/base/223752

Log:
  Add sanity check for ifm_version in struct if_msghdr.

Modified:
  head/usr.sbin/rtadvd/if.c

Modified: head/usr.sbin/rtadvd/if.c
==============================================================================
--- head/usr.sbin/rtadvd/if.c	Mon Jul  4 01:27:41 2011	(r223751)
+++ head/usr.sbin/rtadvd/if.c	Mon Jul  4 03:19:06 2011	(r223752)
@@ -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);


More information about the svn-src-all mailing list