mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
MFB: Adjust previous patch to work better
This commit is contained in:
parent
8373efc9b9
commit
f1fdf21706
1 changed files with 6 additions and 5 deletions
|
@ -156,7 +156,7 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||||
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
|
#define CAAS(s, v) add_assoc_string_ex(return_value, s, sizeof(s), (char *) v, 1);
|
||||||
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
|
#define CAAZ(s, v) add_assoc_zval_ex(return_value, s, sizeof(s), (zval *) v);
|
||||||
|
|
||||||
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len) \
|
#define PHP_CURL_CHECK_OPEN_BASEDIR(str, len, __ret) \
|
||||||
if ((PG(open_basedir) && *PG(open_basedir)) && \
|
if ((PG(open_basedir) && *PG(open_basedir)) && \
|
||||||
strncasecmp(str, "file:", sizeof("file:") - 1) == 0) \
|
strncasecmp(str, "file:", sizeof("file:") - 1) == 0) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -165,16 +165,19 @@ static void _php_curl_close(zend_rsrc_list_entry *rsrc TSRMLS_DC);
|
||||||
if (!(tmp_url = php_url_parse_ex(str, len))) { \
|
if (!(tmp_url = php_url_parse_ex(str, len))) { \
|
||||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", str); \
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid URL '%s'", str); \
|
||||||
RETVAL_FALSE; \
|
RETVAL_FALSE; \
|
||||||
|
return __ret; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (php_memnstr(str, tmp_url->path, strlen(tmp_url->path), str + len)) { \
|
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); \
|
php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL '%s' contains unencoded control characters", str); \
|
||||||
RETVAL_FALSE; \
|
RETVAL_FALSE; \
|
||||||
|
return __ret; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if (tmp_url->query || tmp_url->fragment || php_check_open_basedir(tmp_url->path TSRMLS_CC)) { \
|
if (tmp_url->query || tmp_url->fragment || php_check_open_basedir(tmp_url->path TSRMLS_CC)) { \
|
||||||
php_url_free(tmp_url); \
|
php_url_free(tmp_url); \
|
||||||
RETVAL_FALSE; \
|
RETVAL_FALSE; \
|
||||||
|
return __ret; \
|
||||||
} \
|
} \
|
||||||
php_url_free(tmp_url); \
|
php_url_free(tmp_url); \
|
||||||
}
|
}
|
||||||
|
@ -1076,8 +1079,7 @@ PHP_FUNCTION(curl_init)
|
||||||
|
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
convert_to_string_ex(url);
|
convert_to_string_ex(url);
|
||||||
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(url), Z_STRLEN_PP(url));
|
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(url), Z_STRLEN_PP(url), (void) NULL);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = curl_easy_init();
|
cp = curl_easy_init();
|
||||||
|
@ -1302,8 +1304,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||||
convert_to_string_ex(zvalue);
|
convert_to_string_ex(zvalue);
|
||||||
|
|
||||||
if (option == CURLOPT_URL) {
|
if (option == CURLOPT_URL) {
|
||||||
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
PHP_CURL_CHECK_OPEN_BASEDIR(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue), 1);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
copystr = estrndup(Z_STRVAL_PP(zvalue), Z_STRLEN_PP(zvalue));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue