|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74510 win32/sendmail.c anchors CC header but not BCC
Submitted: 2017-04-28 16:38 UTC Modified: -
From: Assigned:
Status: Closed Package: Mail related
PHP Version: 7.1.4 OS: Windows
Private report: No CVE-ID: None
 [2017-04-28 16:38 UTC]
In win32/sendmail.c:SendText the code that examines headers looks for CC and BCC for special treatment. CC is anchored to the beginning of a line but BCC is not.

If there is an X-*bcc header then it will be recognized as a BCC line and
1. PHP will attempt to RCPT TO the header's value
2. The "X-*" will be merged with the next line (if any) when the header is stripped away.

Fix is to tack on a copy of CC's
  && ((pos1 == headers_lc) || (*(pos1-1) == '\n'))
to that one pos1 condition.

Test script:
$headers = implode("\r\n", [
  "X-Test-Cc: line 2",
  "X-Test-Aabbcc: line 3",
  "X-Line-4: line 4"
mail("", "Subject", "Body", $headers);

Expected result:

X-Test-Cc: line 2
X-Test-Aabbcc: line 3
X-Line-4: line 4

Actual result:
Recipients:,, line 3

X-Test-Cc: line 2
X-Test-AabX-Line-4: line 4


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-02 10:33 UTC]
Automatic comment on behalf of ab
Log: Fixed bug #74510 win32/sendmail.c anchors CC header but not BCC
 [2017-05-02 10:33 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue May 30 02:03:44 2023 UTC