From ad7bc7f22d15ac24f844b707933131baf3f1ff3e Mon Sep 17 00:00:00 2001 From: Matthias Andree Date: Wed, 20 Jul 2005 15:58:43 +0000 Subject: Don't read more data from ifname than fits in the result buffer. svn path=/trunk/; revision=4149 --- interface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'interface.c') diff --git a/interface.c b/interface.c index 45706c0f..b4e7f063 100644 --- a/interface.c +++ b/interface.c @@ -227,9 +227,9 @@ openkvm(void) static int get_ifinfo(const char *ifname, ifinfo_t *ifinfo) { - char tname[16]; + char tname[16]; char iname[16]; - struct ifnet ifnet; + struct ifnet ifnet; unsigned long ifnet_addr = ifnet_savedaddr; #if __FreeBSD_version >= 300001 struct ifnethead ifnethead; @@ -244,7 +244,7 @@ get_ifinfo(const char *ifname, ifinfo_t *ifinfo) if (if_egid) setegid(if_egid); - for (i = 0; ifname[i] && ifname[i] != '/'; i++) + for (i = 0; ifname[i] && ifname[i] != '/' && i < sizeof(iname) - 1; i++) iname[i] = ifname[i]; iname[i] = '\0'; -- cgit v1.2.3