Bug #74510 [NEW]: win32/sendmail.c anchors CC header but not BCC
| From: | requinix@php.net | Date: | Fri, 28 Apr 2017 16:38:33 +0000 |
| Subject: | Bug #74510 [NEW]: win32/sendmail.c anchors CC header but not BCC | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-208841@lists.php.net to get a copy of this message | ||
From: requinix
Operating system: Windows
PHP version: 7.1.4
Package: Mail related
Bug Type: Bug
Bug description:win32/sendmail.c anchors CC header but not BCC
Description:
------------
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", [
"Cc: test+cc@example.com",
"X-Test-Cc: line 2",
"X-Test-Aabbcc: line 3",
"X-Line-4: line 4"
]);
mail("test@example.com", "Subject", "Body", $headers);
Expected result:
----------------
Recipients: test@example.com, test+cc@example.com
Cc: test+cc@example.com
X-Test-Cc: line 2
X-Test-Aabbcc: line 3
X-Line-4: line 4
Actual result:
--------------
Recipients: test@example.com, test+cc@example.com, line 3
Cc: test+cc@example.com
X-Test-Cc: line 2
X-Test-AabX-Line-4: line 4
--
Edit bug report at https://bugs.php.net/bug.php?id=74510&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74510&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74510&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74510&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74510&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74510&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74510&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74510&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74510&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74510&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74510&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74510&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74510&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74510&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74510&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74510&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74510&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74510&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74510&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74510&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74510&r=mysqlcfg