From: Jo-Philipp Wich Date: Thu, 29 Oct 2015 09:53:48 +0000 (+0100) Subject: utils: fix possibly unterminated ifname string X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=89296a5f170067fa13becfdaeee319bae10d4410;p=oweals%2Fiwinfo.git utils: fix possibly unterminated ifname string Signed-off-by: Jo-Philipp Wich --- diff --git a/iwinfo_utils.c b/iwinfo_utils.c index 3b993d1..3090c4c 100644 --- a/iwinfo_utils.c +++ b/iwinfo_utils.c @@ -81,7 +81,7 @@ int iwinfo_ifup(const char *ifname) { struct ifreq ifr; - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); if (iwinfo_ioctl(SIOCGIFFLAGS, &ifr)) return 0; @@ -95,7 +95,7 @@ int iwinfo_ifdown(const char *ifname) { struct ifreq ifr; - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); if (iwinfo_ioctl(SIOCGIFFLAGS, &ifr)) return 0; @@ -109,7 +109,7 @@ int iwinfo_ifmac(const char *ifname) { struct ifreq ifr; - strncpy(ifr.ifr_name, ifname, IFNAMSIZ); + strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1); if (iwinfo_ioctl(SIOCGIFHWADDR, &ifr)) return 0;