utils: fix possibly unterminated ifname string

Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
Jo-Philipp Wich 2015-10-29 10:53:48 +01:00
parent 1e628bb535
commit 89296a5f17

View file

@ -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;