Fix gcc 8 string-op-truncation warning
Don't use the full size of dest in strncpy, we override the last byte anyway afterwards. Change-Id: I9f1618cc9019e0060f01deed58a726caa1989d3f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
8072c36eeb
commit
0ed471419a
@ -132,7 +132,7 @@ static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interf
|
||||
int sock = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
|
||||
ifreq request;
|
||||
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name));
|
||||
strncpy(request.ifr_name, interface.toLocal8Bit().data(), sizeof(request.ifr_name) - 1);
|
||||
request.ifr_name[sizeof(request.ifr_name) - 1] = '\0';
|
||||
int result = ioctl(sock, SIOCGIFHWADDR, &request);
|
||||
close(sock);
|
||||
|
Loading…
Reference in New Issue
Block a user