Closed rapenne-s closed 4 months ago
The extra newline character comes from this line in mmime.c https://github.com/leahneukirchen/mblaze/blob/master/mmime.c#L352
However, removing it breaks the tests and I don't think it's the right solution anyway :sweat_smile:
Ok, I can reproduce this. Let me see how to solve this properly.
I got a diff with which the tests pass, not sure it's good though
diff --git a/mmime.c b/mmime.c
index 6334569..b521efc 100644
--- a/mmime.c
+++ b/mmime.c
@@ -347,7 +347,7 @@ print_header(char *line) {
if (!highbit) {
if (e-s >= 998)
goto force_qp;
- if (e-s >= 78 - linelen) {
+ if (e-s >= 78 - linelen && linelen > 0) {
// wrap in advance before long word
printf("\n");
linelen = 0;
yes, sounds reasonable. in theory, one could wrap the h=
after :
, but this requires special knowledge.
want to make a PR or shall i just pick it up?
want to make a PR or shall i just pick it up?
please fix it, I feel I randomly fixed it without understanding the consequences ;)
Nah, your code is correct: it checks we are not at the beginning of a line.
Fixed in cf5493b.
hi,
when I apply
mmime
(from OpenBSD packages) on an email sent from tuta.io, a newline is added to the field DKIM-Signature, which breaks the emailmy sample email to reproduce it (I slightly modified the original to redact some addresses)
If you pipe it to
mmime
you obtain this result: