diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2006-08-10 14:40:13 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2006-08-10 14:40:13 +0000 |
| commit | a4d2f0430723b4f0cf8a68e8b8a7e549658187ab (patch) | |
| tree | 7886de0385411daf35fc13a65a3281d8aa247413 /ext/curl | |
| parent | e5fe441cbd20df608a1a71e18644caf74c82f691 (diff) | |
| download | php-git-a4d2f0430723b4f0cf8a68e8b8a7e549658187ab.tar.gz | |
Fixed overflow on 64bit systems in str_repeat() and wordwrap().
Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are
enabled.
# Patches by Stefan E.
Diffstat (limited to 'ext/curl')
| -rw-r--r-- | ext/curl/interface.c | 11 | ||||
| -rw-r--r-- | ext/curl/streams.c | 12 |
2 files changed, 20 insertions, 3 deletions
diff --git a/ext/curl/interface.c b/ext/curl/interface.c index dc1efe8021..888a822e66 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1168,7 +1168,6 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu case CURLOPT_FTPLISTONLY: case CURLOPT_FTPAPPEND: case CURLOPT_NETRC: - case CURLOPT_FOLLOWLOCATION: case CURLOPT_PUT: #if CURLOPT_MUTE != 0 case CURLOPT_MUTE: @@ -1219,6 +1218,16 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu convert_to_long_ex(zvalue); error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue)); break; + case CURLOPT_FOLLOWLOCATION: + convert_to_long_ex(zvalue); + if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) { + if (Z_LVAL_PP(zvalue) != 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set"); + RETURN_FALSE; + } + } + error = curl_easy_setopt(ch->cp, option, Z_LVAL_PP(zvalue)); + break; case CURLOPT_URL: case CURLOPT_PROXY: case CURLOPT_USERPWD: diff --git a/ext/curl/streams.c b/ext/curl/streams.c index f4600c00a7..a1758787da 100644 --- a/ext/curl/streams.c +++ b/ext/curl/streams.c @@ -349,11 +349,19 @@ php_stream *php_curl_stream_opener(php_stream_wrapper *wrapper, char *filename, } } if (mr > 1) { - curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1L); + if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) { + curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1); + } else { + curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 0); + } curl_easy_setopt(curlstream->curl, CURLOPT_MAXREDIRS, mr); } } else { - curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1L); + if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) { + curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 1); + } else { + curl_easy_setopt(curlstream->curl, CURLOPT_FOLLOWLOCATION, 0); + } curl_easy_setopt(curlstream->curl, CURLOPT_MAXREDIRS, 20L); } } |
