Add sanity check for ifm_version in struct if_msghdr.
This commit is contained in:
parent
1171f21dab
commit
adfd20273c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=223752
@ -105,6 +105,12 @@ if_nametosdl(char *name)
|
|||||||
lim = buf + len;
|
lim = buf + len;
|
||||||
for (next = buf; next < lim; next += ifm->ifm_msglen) {
|
for (next = buf; next < lim; next += ifm->ifm_msglen) {
|
||||||
ifm = (struct if_msghdr *)next;
|
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) {
|
if (ifm->ifm_type == RTM_IFINFO) {
|
||||||
sa = (struct sockaddr *)(ifm + 1);
|
sa = (struct sockaddr *)(ifm + 1);
|
||||||
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
|
get_rtaddrs(ifm->ifm_addrs, sa, rti_info);
|
||||||
|
Loading…
Reference in New Issue
Block a user