Skip to content

Some more fixes for decoding of headers#440

Open
fumpitz wants to merge 3 commits intojsuto:masterfrom
fumpitz:encoded_header
Open

Some more fixes for decoding of headers#440
fumpitz wants to merge 3 commits intojsuto:masterfrom
fumpitz:encoded_header

Conversation

@fumpitz
Copy link
Copy Markdown
Contributor

@fumpitz fumpitz commented Mar 31, 2026

Previous fix #359 didn't handle TABs in folded headers completely.

Found and fixed a bug where a single quoted-printable encoded b (e.g. =?iso-8859-1?Q?b?=) was mistakenly decoded as base64 encoding, because strcasestr(e, "?B?") grabbed the ?b? instead of testing the ?Q?. Switched to strncasecmp(...) to make sure only the first 3 characters are compared. Though this sounds weird, it can happen if an encoded header hits the length limit of a single encoded word.

Added testcases for #359 and for TAB folding (plus single encoded b)

Frank Schmirler added 3 commits March 31, 2026 17:23
- partial encoding of words (non-standard compliant but occurs in the wild)
- multiline headers folded with TAB characters
@fumpitz fumpitz requested a review from jsuto as a code owner March 31, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant