diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 7b0aa52831..7472758418 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -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);