From 8a0a999d54f796194c9e92c8cb82d672b0828b2f Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Wed, 24 Jun 2020 11:15:54 +0300 Subject: [PATCH] Merge pull request #13042 from FranciscoPombal/fix_request_parser Fix truncation when parsing HTTP request query --- src/CMakeLists.txt | 1 + src/base/http/requestparser.cpp | 2 +- src/src.pro | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8c45bb701a6..a73d89e8189 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,6 +36,7 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) # defines add_definitions(-DQT_DEPRECATED_WARNINGS) add_definitions(-DQT_NO_CAST_TO_ASCII) +add_definitions(-DQT_NO_CAST_FROM_BYTEARRAY) add_definitions(-DQT_USE_QSTRINGBUILDER) add_definitions(-DQT_STRICT_ITERATORS) diff --git a/src/base/http/requestparser.cpp b/src/base/http/requestparser.cpp index e6e1853f6d0..3f74b7a7629 100644 --- a/src/base/http/requestparser.cpp +++ b/src/base/http/requestparser.cpp @@ -202,7 +202,7 @@ bool RequestParser::parseRequestLine(const QString &line) const QByteArray valueComponent = midView(param, (eqCharPos + 1)); const QString paramName = QString::fromUtf8(QByteArray::fromPercentEncoding(nameComponent).replace('+', ' ')); const QByteArray paramValue = valueComponent.isNull() - ? "" + ? QByteArray("") : QByteArray::fromPercentEncoding(valueComponent).replace('+', ' '); m_request.query[paramName] = paramValue; diff --git a/src/src.pro b/src/src.pro index bf64d2860cd..5ad945bfecc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -57,6 +57,7 @@ include(../version.pri) # Qt defines DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_NO_CAST_TO_ASCII +DEFINES += QT_NO_CAST_FROM_BYTEARRAY DEFINES += QT_USE_QSTRINGBUILDER DEFINES += QT_STRICT_ITERATORS