[Bug 15724] New: sendmail creating non-RFC-compliant headers with PHP8

bugzilla at busybox.net bugzilla at busybox.net
Tue Aug 15 04:01:54 UTC 2023


https://bugs.busybox.net/show_bug.cgi?id=15724

            Bug ID: 15724
           Summary: sendmail creating non-RFC-compliant headers with PHP8
           Product: Busybox
           Version: 1.35.x
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P5
         Component: Standard Compliance
          Assignee: unassigned at busybox.net
          Reporter: axllent at gmail.com
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

As of PHP8.0, email headers are separated with a <CRLF> (`\r\n`) rather than
<LF> (`\n`) as seen in older versions of PHP. This is causing all sorts of
issues when used in conjunction with busybox's sendmail implementation in
conjunction with an RFC-complaint SMTP server. 

I am no C expert, but from what I can see, busybox splits lines using
xmalloc_fgetline() which trims the trailing `\n`
(https://git.busybox.net/busybox/tree/libbb/get_line_from_file.c#n172), and
then rebuilds the headers using send_r_n()
(https://git.busybox.net/busybox/tree/mailutils/mail.c#n85) which appends a
`\r\n` to each line. This results in header lines with a non-RFC-compliant
`\r\r\n`.

This issue was first raised with with a project of mine
(https://github.com/axllent/mailpit/issues/87), which led me to a a PHP bug
reported (https://github.com/php/php-src/issues/8086) relating to the same
thing. I would have assumed this issue would have been reported to busybox by
now, but I can't see any reference to it.

Whilst there are some work-arounds, this isn't always an option, so fixing this
at the sendmail level is the best approach as that appears to be where the
issue is stemming from here.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list