summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorPeter Hartmann <phartmann@blackberry.com>2013-06-13 17:43:56 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-06-19 15:15:37 +0200
commitc983155192e563ff879f571586470ae51daf4a89 (patch)
tree170c2ae836c074ac9e19b2ae3edd7ef04306db2c /src/network
parentb20cb63f457930651cf7aa9108df5432e25dcc46 (diff)
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.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qnetworkrequest.cpp b/src/network/access/qnetworkrequest.cpp
index 683fd90e70..271a2688a9 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':