utils: fix possibly unterminated ifname string
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
This commit is contained in:
parent
1e628bb535
commit
89296a5f17
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue