From 89296a5f170067fa13becfdaeee319bae10d4410 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 29 Oct 2015 10:53:48 +0100 Subject: [PATCH] utils: fix possibly unterminated ifname string Signed-off-by: Jo-Philipp Wich --- iwinfo_utils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.25.1