File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 46
46
#include "netware/sysexits.h" /* For exit status codes like EX_OK */
47
47
#endif
48
48
49
+ #define SKIP_LONG_HEADER_SEP (str , pos ) \
50
+ if (str[pos] == '\r' && str[pos + 1] == '\n' && (str[pos + 2] == ' ' || str[pos + 2] == '\t')) { \
51
+ pos += 3; \
52
+ while (str[pos] == ' ' || str[pos] == '\t') { \
53
+ pos++; \
54
+ } \
55
+ continue; \
56
+ } \
57
+
49
58
/* {{{ proto int ezmlm_hash(string addr)
50
59
Calculate EZMLM list hash value. */
51
60
PHP_FUNCTION (ezmlm_hash )
@@ -102,6 +111,12 @@ PHP_FUNCTION(mail)
102
111
}
103
112
for (i = 0 ; to [i ]; i ++ ) {
104
113
if (iscntrl ((unsigned char ) to [i ])) {
114
+ /* According to RFC 822, section 3.1.1 long headers may be separated into
115
+ * parts using CRLF followed at least one linear-white-space character ('\t' or ' ').
116
+ * To prevent these separators from being replaced with a space, we use the
117
+ * SKIP_LONG_HEADER_SEP to skip over them.
118
+ */
119
+ SKIP_LONG_HEADER_SEP (to , i );
105
120
to [i ] = ' ' ;
106
121
}
107
122
}
@@ -116,6 +131,7 @@ PHP_FUNCTION(mail)
116
131
}
117
132
for (i = 0 ; subject [i ]; i ++ ) {
118
133
if (iscntrl ((unsigned char ) subject [i ])) {
134
+ SKIP_LONG_HEADER_SEP (subject , i );
119
135
subject [i ] = ' ' ;
120
136
}
121
137
}
You can’t perform that action at this time.
0 commit comments