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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to