diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2005-07-20 15:58:43 +0000 |
---|---|---|
committer | Matthias Andree <matthias.andree@gmx.de> | 2005-07-20 15:58:43 +0000 |
commit | ad7bc7f22d15ac24f844b707933131baf3f1ff3e (patch) | |
tree | 797354899241360f2c5e556e1fa718d0b67ff2c9 /interface.c | |
parent | 242d146993acd48a8b25f5acbaadf95d7efba305 (diff) | |
download | fetchmail-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
Diffstat (limited to 'interface.c')
-rw-r--r-- | interface.c | 6 |
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'; |