]> granicus.if.org Git - php/commitdiff
MFH: Added control character checks for cURL extension's
authorIlia Alshanetsky <iliaa@php.net>
Sun, 21 May 2006 16:32:51 +0000 (16:32 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Sun, 21 May 2006 16:32:51 +0000 (16:32 +0000)
open_basedir/safe_mode checks.

NEWS
ext/curl/curl.c

diff --git a/NEWS b/NEWS
index 2ee7e5de68c6d09181d8b757407e758ec6bce8aa..027ee411e71cd849b1d0ded5f942c57439cbc716 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2006, Version 4.4.3
+- Added control character checks for cURL extension's open_basedir/safe_mode
+  checks. (Ilia)
 - Fixed a possible buffer overflow inside create_named_pipe() for Win32 systems
   in libmysql.c. (Ilia)
 - Updated PCRE to version 6.6. (Andrei)
index 931aafaeb45e18eaf7431343c571c753f58d9f8a..2f73da2213b43def312c1e07c6dd3ed86c192aa9 100644 (file)
@@ -162,11 +162,16 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
            strncasecmp(str, "file:", sizeof("file:") - 1) == 0)                                                                \
        {                                                                                                                                                                                       \
                php_url *tmp_url;                                                                                                                                               \
-                                                                                                                                                                                               \
+                                                                                                                       \
                if (!(tmp_url = php_url_parse_ex(str, len))) {                                                                                  \
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid url '%s'", str);                           \
                        RETURN_FALSE;                                                                                                                                           \
                }                                                                                                                                                                               \
+                                                                                                                       \
+               if (php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) {                                \
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Url '%s' contains unencoded control characters.", str);    \
+                       RETURN_FALSE;                                                                                   \
+               }                                                                                                       \
                                                                                                                                                                                                \
                if (tmp_url->query || tmp_url->fragment || php_check_open_basedir(tmp_url->path TSRMLS_CC) ||                                                                   \
                        (PG(safe_mode) && !php_checkuid(tmp_url->path, "rb+", CHECKUID_CHECK_MODE_PARAM))       \