ppp_net: Make static analysis tools happy

The kernel simply puts a null terminator at index 15 prior to ifr_name
processing.  So we do the same.

Original report by:
Sabas Rosales, Blanca E <blanca.e.sabas.rosales@intel.com>

 Buffer not null terminated (BUFFER_SIZE_WARNING) buffer_size_warning:
 Calling strncpy with a maximum size argument of 16 bytes on destination
 array ifr.ifr_ifrn.ifrn_name of size 16 bytes might leave the
 destination string unterminated.

  67        strncpy(ifr.ifr_name, net->if_name, sizeof(ifr.ifr_name));
This commit is contained in:
Denis Kenzior 2015-07-28 10:16:16 -05:00
parent dbb3ec13e5
commit ca105f7040
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ gboolean ppp_net_set_mtu(struct ppp_net *net, guint16 mtu)
return FALSE;
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_name, net->if_name, sizeof(ifr.ifr_name));
strncpy(ifr.ifr_name, net->if_name, IFNAMSIZ - 1);
ifr.ifr_mtu = mtu;
err = ioctl(sk, SIOCSIFMTU, (void *) &ifr);