From 0fa7fca31e668df6a0971e4f9d1a25bfa5f111f5 Mon Sep 17 00:00:00 2001 From: FranciscoPombal Date: Fri, 19 Jun 2020 16:28:47 +0100 Subject: [PATCH] Fix truncation when parsing HTTP request query Closes #13029. Fixes an issue with truncation of a QByteArray at the first '\0' byte when parsing HTTP request query strings. Previously, the operands of the ternary expression were of different types. Most likely this was leading to a conversion of the result to some kind of '\0'-terminated string type somewhere along the way, in turn causing its truncation at the first '\0' byte once converted back to QByteArray. For some reason this bug was only present on Windows (MSVC). --- src/base/http/requestparser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/http/requestparser.cpp b/src/base/http/requestparser.cpp index e6e1853f6..3f74b7a76 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;