]> granicus.if.org Git - php/commitdiff
MFB51: Fixed bug #37045 (Fixed check for special chars for http redirects).
authorIlia Alshanetsky <iliaa@php.net>
Sun, 16 Apr 2006 16:55:25 +0000 (16:55 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 16 Apr 2006 16:55:25 +0000 (16:55 +0000)
ext/standard/http_fopen_wrapper.c

index 81bc0be112dab88f65931106b9ad5731cd7a875f..6232c16df912e7419cd96d59388fafdefb3f56f5 100644 (file)
@@ -691,10 +691,11 @@ php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, char *path,
        }       \
 }      \
                        /* check for control characters in login, password & path */
-                       CHECK_FOR_CNTRL_CHARS(resource->user)
-                       CHECK_FOR_CNTRL_CHARS(resource->pass)
-                       CHECK_FOR_CNTRL_CHARS(resource->path)
-
+                       if (strncasecmp(newpath, "http://", sizeof("http://") - 1) || strncasecmp(newpath, "https://", sizeof("https://") - 1) {
+                               CHECK_FOR_CNTRL_CHARS(resource->user)
+                               CHECK_FOR_CNTRL_CHARS(resource->pass)
+                               CHECK_FOR_CNTRL_CHARS(resource->path)
+                       }
                        stream = php_stream_url_wrap_http_ex(wrapper, new_path, mode, options, opened_path, context, --redirect_max, 0 STREAMS_CC TSRMLS_CC);
                } else {
                        php_stream_wrapper_log_error(wrapper, options TSRMLS_CC, "HTTP request failed! %s", tmp_line);