strncpy may left destination buffer not NULL terminated, switched using
snprintf to be sure destination buffer is NULL terminated.
Coverity issue:
1407495
Coverity issue:
1407498
Fixes:
cc68ac4847bc ("net/af_packet: support MTU change")
Fixes:
218259590ea4 ("net/af_packet: support promiscuous")
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
if (s < 0)
return -EINVAL;
- strncpy(ifr.ifr_name, internals->if_name, IFNAMSIZ);
+ snprintf(ifr.ifr_name, IFNAMSIZ, "%s", internals->if_name);
ret = ioctl(s, SIOCSIFMTU, &ifr);
close(s);
if (s < 0)
return;
- strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
+ snprintf(ifr.ifr_name, IFNAMSIZ, "%s", if_name);
if (ioctl(s, SIOCGIFFLAGS, &ifr) < 0)
goto out;
ifr.ifr_flags &= mask;