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

Reinstate 76 character soft line breaks in qpe, fix bug in resetting … #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions qpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,25 @@ int qp_encode( char *out, size_t out_size, char *in, size_t in_size, char *line_
charout_size = 1;
}

if (current_line_length +charout_size >= 79) { // Was 76, updated to fix Outlook problems
// 0.3.10 and before (to when it was nerfed for Outlook - failed to soft wrap lines in all quoted-printable output
// resulting in part busting the RFC821 1000 character line limit. MTAs would then insert newlines and so breaking
// the part and also voiding any DKIM signature. This reinstates the 76 character soft line breaks and fixes an
// off-by-one error in resetting the current_line_length
// [email protected]

if (current_line_length +charout_size >= 76) {
//snprintf(op, out_remaining, "%s=\r\n", paragraph);
snprintf(op, out_remaining, "%s=%s", paragraph, line_terminator);
op+= strlen(paragraph);// +3; /** jump the output + =\r\n **/
out_remaining-= (strlen(paragraph)); // Was +3, updated to fix Outlook problems
op+= strlen(paragraph) +3;// /** jump the output + =\r\n **/
out_remaining-= (strlen(paragraph) +3);

QPD LOGGER_log("%s:%d:qp_encode:DEBUG: Soft break (%Zd + %d > 76 char) for '%s'", FL, current_line_length, charout_size, paragraph);

/** reinitialize the paragraph **/
paragraph[0] = '\0';
pp_remaining = sizeof(paragraph);
pp = paragraph;
current_line_length=-1;
current_line_length=0;

}

Expand Down