From 08dbfb691d8e03c7200138d55447fc29916e0362 Mon Sep 17 00:00:00 2001 From: ajs Date: Sun, 3 Apr 2005 03:40:52 +0000 Subject: 2005-04-02 Andrew J. Schorr * if_ioctl.c: (interface_list_ioctl) Use if_get_by_name_len. * if_proc.c: (ifaddr_proc_ipv6) Increase size of ifname buffer to avoid overflow. * kernel_socket.c: (ifan_read) Use if_get_by_name_len. * if.h: Fix comments to reflect that if_lookup_by_name and if_get_by_name now require the argument strings to be NUL-terminated. * if.c: (if_lookup_by_name) Compare using strcmp. (if_get_by_name) Pass strlen(ifname) as 2nd arg to if_create. --- zebra/ChangeLog | 7 +++++++ zebra/if_ioctl.c | 8 ++++++-- zebra/if_proc.c | 2 +- zebra/kernel_socket.c | 4 +++- 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'zebra') diff --git a/zebra/ChangeLog b/zebra/ChangeLog index 924f0f0a..1d0f1754 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,10 @@ +2005-04-02 Andrew J. Schorr + + * if_ioctl.c: (interface_list_ioctl) Use if_get_by_name_len. + * if_proc.c: (ifaddr_proc_ipv6) Increase size of ifname buffer to + avoid overflow. + * kernel_socket.c: (ifan_read) Use if_get_by_name_len. + 2005-04-02 Andrew J. Schorr * kernel_socket.c: (ifm_read) Use new if_lookup_by_name_len function diff --git a/zebra/if_ioctl.c b/zebra/if_ioctl.c index 90f18e28..0d7713db 100644 --- a/zebra/if_ioctl.c +++ b/zebra/if_ioctl.c @@ -102,7 +102,9 @@ interface_list_ioctl () int size; ifreq = (struct ifreq *)((caddr_t) ifconf.ifc_req + n); - ifp = if_get_by_name (ifreq->ifr_name); + ifp = if_get_by_name_len(ifreq->ifr_name, + strnlen(ifreq->ifr_name, + sizeof(ifreq->ifr_name))); if_add_update (ifp); size = ifreq->ifr_addr.sa_len; if (size < sizeof (ifreq->ifr_addr)) @@ -113,7 +115,9 @@ interface_list_ioctl () #else for (n = 0; n < ifconf.ifc_len; n += sizeof(struct ifreq)) { - ifp = if_get_by_name (ifreq->ifr_name); + ifp = if_get_by_name_len(ifreq->ifr_name, + strnlen(ifreq->ifr_name, + sizeof(ifreq->ifr_name))); if_add_update (ifp); ifreq++; } diff --git a/zebra/if_proc.c b/zebra/if_proc.c index 504d2f3c..3257d03c 100644 --- a/zebra/if_proc.c +++ b/zebra/if_proc.c @@ -212,7 +212,7 @@ ifaddr_proc_ipv6 () char buf[PROCBUFSIZ]; int n; char addr[33]; - char ifname[20]; + char ifname[21]; int ifindex, plen, scope, status; struct interface *ifp; struct prefix_ipv6 p; diff --git a/zebra/kernel_socket.c b/zebra/kernel_socket.c index 12125630..c1f785d4 100644 --- a/zebra/kernel_socket.c +++ b/zebra/kernel_socket.c @@ -201,7 +201,9 @@ ifan_read (struct if_announcemsghdr *ifan) if (ifp == NULL && ifan->ifan_what == IFAN_ARRIVAL) { /* Create Interface */ - ifp = if_get_by_name (ifan->ifan_name); + ifp = if_get_by_name_len(ifan->ifan_name, + strnlen(ifan->ifan_name, + sizeof(ifan->ifan_name))); ifp->ifindex = ifan->ifan_index; if_add_update (ifp); -- cgit v1.2.1