diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2014-08-19 12:55:04 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2014-08-19 18:14:01 +0200 |
commit | b8989f937aa931113845dcd65b5d1a7e5fd8bee4 (patch) | |
tree | 3bf46809fc1ae33fbb97c30d74437cd09a9c9188 /src | |
parent | 6b6e51e5abf56f938c27d194701e2bb20f3459dd (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/bearer/generic/qgenericengine.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d2579372c7..d687539d84 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -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); |