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

Change-Id: I31b3e964502c05b7614c23876bb3752fa75ab22d
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
bb10
Peter Hartmann 2013-06-13 17:43:56 +02:00 committed by The Qt Project
parent 19ed991e56
commit dd050d35d7
1 changed files with 2 additions and 1 deletions

View File

@ -752,7 +752,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':