summaryrefslogtreecommitdiff
path: root/sapi/cgi/cgi_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cgi/cgi_main.c')
-rw-r--r--sapi/cgi/cgi_main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
index 2174729eee..336bee186c 100644
--- a/sapi/cgi/cgi_main.c
+++ b/sapi/cgi/cgi_main.c
@@ -1689,9 +1689,9 @@ static void add_response_header(sapi_header_struct *h, zval *return_value) /* {{
len = p - h->header;
}
if (len > 0) {
- do {
+ while (len != 0 && (h->header[len-1] == ' ' || h->header[len-1] == '\t')) {
len--;
- } while (len != 0 && (h->header[len-1] == ' ' || h->header[len-1] == '\t'));
+ }
if (len) {
s = do_alloca(len + 1, use_heap);
memcpy(s, h->header, len);