From 0cd96fce7e5477aebed341e996fcc903f0e6a835 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 27 Jan 2025 12:38:06 +0100 Subject: Fix utf8received failing to detect empty newlines (body starts) This resulted in invalid mail encoding (bare LF, \r\n\n) --- qmail-remote.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qmail-remote.c b/qmail-remote.c index 14114cf..ee2c6a8 100644 --- a/qmail-remote.c +++ b/qmail-remote.c @@ -777,7 +777,10 @@ int utf8received() } } if (!stralloc_copys(&receivedline,"")) temp_nomem(); - receivedline.len = 0; + } else if (ch == '\n' && !receivedline.len) { /* we got an empty newline. probably body start */ + if (!stralloc_append(&header,"\r")) temp_nomem(); + if (!stralloc_append(&header,"\n")) temp_nomem(); + return 0; } else { if (!stralloc_append(&header,&ch)) temp_nomem(); if (!stralloc_catb(&receivedline,&ch,1)) temp_nomem(); -- cgit v1.2.3