diff options
author | Peter Hartmann <phartmann@blackberry.com> | 2013-06-13 15:43:56 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-06-19 13:15:37 (GMT) |
commit | c983155192e563ff879f571586470ae51daf4a89 (patch) | |
tree | 170c2ae836c074ac9e19b2ae3edd7ef04306db2c /src/network | |
parent | b20cb63f457930651cf7aa9108df5432e25dcc46 (diff) | |
download | Qt-c983155192e563ff879f571586470ae51daf4a89.zip Qt-c983155192e563ff879f571586470ae51daf4a89.tar.gz Qt-c983155192e563ff879f571586470ae51daf4a89.tar.bz2 |
network requests: do not access 1st byte of empty byte array
... because otherwise this would crash.
Apparently there are cases where the header name is empty.
Task-number: QTBUG-31667
(cherry picked from commit dd050d35d77e2f6ac37bd1266a843df55848022f)
Change-Id: I4c99094d2bad3ebb7cf44f83f9ed6a5f73b73016
Reviewed-by: Richard J. Moore <rich@kde.org>
Diffstat (limited to 'src/network')
-rw-r--r-- | src/network/access/qnetworkrequest.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp index 683fd90..271a268 100644 --- a/src/network/access/qnetworkrequest.cpp +++ b/src/network/access/qnetworkrequest.cpp @@ -715,7 +715,8 @@ static QByteArray headerValue(QNetworkRequest::KnownHeaders header, const QVaria static QNetworkRequest::KnownHeaders parseHeaderName(const QByteArray &headerName) { - // headerName is not empty here + if (headerName.isEmpty()) + return QNetworkRequest::KnownHeaders(-1); switch (tolower(headerName.at(0))) { case 'c': |