diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2003-02-24 19:41:18 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2003-02-24 19:41:18 +0000 |
| commit | 4474f9225a599d3f4cd3674e777d40a531d3c63b (patch) | |
| tree | bce74e366a72dcb7312a36afb50bed4440062932 /ext/standard | |
| parent | a628a6a2de539b0a4411882686488b4b522d0f52 (diff) | |
| download | php-git-4474f9225a599d3f4cd3674e777d40a531d3c63b.tar.gz | |
Fixed bug #22355 (PHP would remove folding from Subject & To fields).
Diffstat (limited to 'ext/standard')
| -rw-r--r-- | ext/standard/mail.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ext/standard/mail.c b/ext/standard/mail.c index b340578993..3dd51cb3df 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -46,6 +46,15 @@ #include "netware/sysexits.h" /* For exit status codes like EX_OK */ #endif +#define SKIP_LONG_HEADER_SEP(str, pos) \ + if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \ + pos += 3; \ + while (str[pos] == ' ' || str[pos] == '\t') { \ + pos++; \ + } \ + continue; \ + } \ + /* {{{ proto int ezmlm_hash(string addr) Calculate EZMLM list hash value. */ PHP_FUNCTION(ezmlm_hash) @@ -102,6 +111,12 @@ PHP_FUNCTION(mail) } for (i = 0; to[i]; i++) { if (iscntrl((unsigned char) to[i])) { + /* According to RFC 822, section 3.1.1 long headers may be separated into + * parts using CRLF followed at least one linear-white-space character ('\t' or ' '). + * To prevent these separators from being replaced with a space, we use the + * SKIP_LONG_HEADER_SEP to skip over them. + */ + SKIP_LONG_HEADER_SEP(to, i); to[i] = ' '; } } @@ -116,6 +131,7 @@ PHP_FUNCTION(mail) } for(i = 0; subject[i]; i++) { if (iscntrl((unsigned char) subject[i])) { + SKIP_LONG_HEADER_SEP(subject, i); subject[i] = ' '; } } |
