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: buffer overrun when quoted printable is at the end of line and output buffer #254

Merged
merged 2 commits into from
Jun 5, 2022

Conversation

pavelbazika
Copy link
Contributor

In QPCleaner, write behind the buffer end could occur, when there was a =XX quoted printable token, line length was 1023 and remaining dest buffer space was only 1 byte. Because of line length, QPCleaner inserted =\r\n, but only the equal sign fit into the output buffer. The rest went to qp.overflow.

Then the algorithm wrote to dest[n] without any additional checks, but n already pointed behind the buffer end.

Now the equal sign is also written to overflow in such situation.

I've also noticed, that qp.lineLength is not incremented when qp.overflow is put at the beginning of new buffer and also when = from quoted printable token is inserted. Seems as a bug to me, but I don't fix it in this PR.

Copy link
Owner

@jhillyerd jhillyerd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, one small change requested. Should I file a bug for the other issue you mentioned?

@pavelbazika
Copy link
Contributor Author

Thanks, one small change requested. Should I file a bug for the other issue you mentioned?

No need to file a bug, I'll fix it and come with a PR. I just wanted to ensure, that lineLength should be incremented in all circumstances.

@jhillyerd jhillyerd merged commit d29462e into jhillyerd:master Jun 5, 2022
@pavelbazika pavelbazika deleted the linebreak-overflow branch June 5, 2022 18:46
@jmdacruz
Copy link

Can we get a release that includes this fix?

@jhillyerd
Copy link
Owner

Just tagged 0.10.0

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.

3 participants