aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2005-07-20 15:58:43 +0000
committerMatthias Andree <matthias.andree@gmx.de>2005-07-20 15:58:43 +0000
commitad7bc7f22d15ac24f844b707933131baf3f1ff3e (patch)
tree797354899241360f2c5e556e1fa718d0b67ff2c9
parent242d146993acd48a8b25f5acbaadf95d7efba305 (diff)
downloadfetchmail-ad7bc7f22d15ac24f844b707933131baf3f1ff3e.tar.gz
fetchmail-ad7bc7f22d15ac24f844b707933131baf3f1ff3e.tar.bz2
fetchmail-ad7bc7f22d15ac24f844b707933131baf3f1ff3e.zip
Don't read more data from ifname than fits in the result buffer.
svn path=/trunk/; revision=4149
-rw-r--r--interface.c6
1 files changed, 3 insertions, 3 deletions
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';