Properly null-terminate ifreq::irf_name
It's unclear whether it has to be, but there are a lot of patches floating around on the net that indicate that Coverty requires this, and the SIOCGIFADDR micro-howto also NUL-terminates the string. So who is Qt to differ? Change-Id: I1aa5a2de47a58b1d9b73556d5a6ddc48b2c40ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
6b6e51e5ab
commit
b8989f937a
|
|
@ -165,6 +165,7 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
|
|||
|
||||
ifreq request;
|
||||
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
|
||||
request.ifr_name[sizeof(request.ifr_name) - 1] = '\0';
|
||||
int result = ioctl(sock, SIOCGIFHWADDR, &request);
|
||||
close(sock);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue