1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-27 06:54:20 +00:00

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).
This commit is contained in:
FranciscoPombal 2020-06-19 16:28:47 +01:00
parent 9dfeeb9e81
commit 0fa7fca31e

View File

@ -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;