diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-24 13:38:54 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2019-06-28 00:24:32 +0200 |
commit | 3ccbf19761ec203a88480d25f147cac047a58ee3 (patch) | |
tree | 4e9d0e04fe63e9c88e420b71f49194dfcac3cbe7 /src/network | |
parent | 168b18de2d1429dc4f8c8db538c0a2cf3141c694 (diff) |
QSocks5SocketEnginePrivate::sendRequestMethod(): Fix out of bounds string access
Fix warnings showing in network tests:
tst_QNetworkReply::headFromHttp(rfc+socks):
Using QCharRef with an index pointing outside the valid range of a QString. The corresponding behavior is deprecated, and will be changed in a future version of Qt.
introduced by qtbase/c2d2757bccc68e1b981df059786c2e76f2969530 (5.14).
Replace index access by QByteArray::append().
Change-Id: I0b4aed563d076237d5f9cc6aa438c7502eb3568c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/socket/qsocks5socketengine.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/network/socket/qsocks5socketengine.cpp b/src/network/socket/qsocks5socketengine.cpp index 23aec12390..47b500227f 100644 --- a/src/network/socket/qsocks5socketengine.cpp +++ b/src/network/socket/qsocks5socketengine.cpp @@ -801,9 +801,9 @@ void QSocks5SocketEnginePrivate::sendRequestMethod() QByteArray buf; buf.reserve(270); // big enough for domain name; - buf[0] = S5_VERSION_5; - buf[1] = command; - buf[2] = 0x00; + buf.append(char(S5_VERSION_5)); + buf.append(command); + buf.append('\0'); if (peerName.isEmpty() && !qt_socks5_set_host_address_and_port(address, port, &buf)) { QSOCKS5_DEBUG << "error setting address" << address << " : " << port; //### set error code .... |