Fix memcpy overwrite in iproute.c because of bits vs. bytes confusion

This commit is contained in:
shemminger 2005-10-12 22:49:50 +00:00
parent 8c564a4873
commit 7849fb5591
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,8 @@
2005-10-12 Stephen Hemminger <shemminger@osdl.org>
* Add more CBQ examples from Fedora Core
* Fix buffer overrun in iproute because of bits vs. bytes confusion
2005-10-12 Jamal Hadi Salim <hadi@znyx.com>
* Fix ip rule flush, need to reopen rtnl

View File

@ -216,13 +216,13 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
memset(&via, 0, sizeof(via));
via.family = r->rtm_family;
if (tb[RTA_GATEWAY])
memcpy(&via.data, RTA_DATA(tb[RTA_GATEWAY]), host_len);
memcpy(&via.data, RTA_DATA(tb[RTA_GATEWAY]), host_len/8);
}
if (filter.rprefsrc.bitlen>0) {
memset(&prefsrc, 0, sizeof(prefsrc));
prefsrc.family = r->rtm_family;
if (tb[RTA_PREFSRC])
memcpy(&prefsrc.data, RTA_DATA(tb[RTA_PREFSRC]), host_len);
memcpy(&prefsrc.data, RTA_DATA(tb[RTA_PREFSRC]), host_len/8);
}
if (filter.rdst.family && inet_addr_match(&dst, &filter.rdst, filter.rdst.bitlen))