smtp: fix EOB handling

SMTP automatically appends a \n.\n to an upload if there is not already
one at the end of the input. The implementation had a bug where this did
not happen, depending on read size and buffering.

Change test 900 to reproduce the failure. The bug only happened for mail
body input of known length, where EOS was known on the last chunk read.
Change test 900 to use an input file and make it large enough.

Fixes #18798
Closes #19193
Reported-by: madoe on github
This commit is contained in:
Stefan Eissing 2025-10-22 15:04:53 +02:00 committed by Daniel Stenberg
parent 0a79a599a9
commit a330117bb0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 36 additions and 25 deletions

View file

@ -19,14 +19,16 @@ smtp
<name>
SMTP
</name>
<stdin>
<file name="%LOGDIR/mail%TESTNUMBER">
From: different
To: another
body
</stdin>
%repeat[6553 x 0123456789]%
</file>
<command>
smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient@example.com --mail-from sender@example.com -T -
smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient@example.com --mail-from sender@example.com -T %LOGDIR/mail%TESTNUMBER
</command>
</client>
@ -45,6 +47,8 @@ From: different
To: another
body
%repeat[6553 x 0123456789]%
.
</upload>
</verify>