Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix truncation when parsing HTTP request query #13042

Merged
merged 2 commits into from
Jun 24, 2020

Conversation

FranciscoPombal
Copy link
Member

@FranciscoPombal FranciscoPombal commented Jun 19, 2020

Closes #13029.

  • Don't use different types in ternary expression operands to prevent truncation at first \0 byte when parsing HTTP request query strings.
  • Add QT_NO_CAST_FROM_BYTEARRAY to compile definitions to prevent this class of bugs, even if different types are used in the ternary expression operands.

@FranciscoPombal FranciscoPombal added Core OS: Windows Issues specific to Windows labels Jun 19, 2020
Closes qbittorrent#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).
Prevents bugs like qbittorrent#13029, even if the ternary expression operands
have different types.
@Chocobo1 Chocobo1 changed the title Fix request parser Fix truncation when parsing HTTP request query Jun 23, 2020
@Chocobo1 Chocobo1 added this to the 4.2.6 milestone Jun 23, 2020
@glassez glassez merged commit 06e1b07 into qbittorrent:master Jun 24, 2020
@glassez
Copy link
Member

glassez commented Jun 24, 2020

Thank you!

@FranciscoPombal FranciscoPombal deleted the fix_request_parser branch June 24, 2020 08:32
IceCodeNew pushed a commit to IceCodeNew/qBittorrent-Enhanced-Edition that referenced this pull request Aug 28, 2020
…_parser

Fix truncation when parsing HTTP request query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core OS: Windows Issues specific to Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Suspect Tracker Issue
3 participants