mirror of git://git.sysmocom.de/ofono
cdma-connman: 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. 92 strncpy(ifr.ifr_name, interface, IFNAMSIZ);
This commit is contained in:
parent
ca105f7040
commit
8be0245664
|
@ -89,7 +89,7 @@ static void cdma_connman_ifupdown(const char *interface, ofono_bool_t active)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(&ifr, 0, sizeof(ifr));
|
memset(&ifr, 0, sizeof(ifr));
|
||||||
strncpy(ifr.ifr_name, interface, IFNAMSIZ);
|
strncpy(ifr.ifr_name, interface, IFNAMSIZ - 1);
|
||||||
|
|
||||||
if (ioctl(sk, SIOCGIFFLAGS, &ifr) < 0)
|
if (ioctl(sk, SIOCGIFFLAGS, &ifr) < 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
Loading…
Reference in New Issue