diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-02-03 08:48:34 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-02-03 08:48:34 +0000 |
commit | 8e82bda330264d290a5e55580eea2eb875d4cb69 (patch) | |
tree | d110c0d71f98c82333feaf7bb19cf704665045a4 /main | |
parent | fa579f2f9b05f3f676892d8d08c7ec23ad5b4b56 (diff) | |
download | php-git-8e82bda330264d290a5e55580eea2eb875d4cb69.tar.gz |
- Merging r323033 into 5.3 (see bug #60227).
Diffstat (limited to 'main')
-rw-r--r-- | main/SAPI.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/main/SAPI.c b/main/SAPI.c index 154ab6bf29..693cad3429 100644 --- a/main/SAPI.c +++ b/main/SAPI.c @@ -591,10 +591,11 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg TSRMLS_DC) } } else { /* new line safety check */ - char *s = header_line, *e = header_line + header_line_len, *p; - while (s < e && ((p = memchr(s, '\n', (e - s))) || (p = memchr(s, '\r', (e - s))))) { - if (*(p + 1) == ' ' || *(p + 1) == '\t') { - s = p + 1; + char *s = header_line; + while (s = strpbrk(s, "\n\r")) { + if (s[1] == ' ' || s[1] == '\t') { + /* RFC 2616 allows new lines if followed by SP or HT */ + s++; continue; } efree(header_line); |