mirror of
https://github.com/php/php-src.git
synced 2025-08-19 17:04:47 +02:00
fix bug #48518 (curl crashes when writing into invalid file handle)
This commit is contained in:
parent
433286f150
commit
c6cd73e7d1
1 changed files with 2 additions and 0 deletions
|
@ -1666,6 +1666,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case CURLOPT_FILE:
|
case CURLOPT_FILE:
|
||||||
if (((php_stream *) what)->mode[0] != 'r') {
|
if (((php_stream *) what)->mode[0] != 'r') {
|
||||||
|
zend_list_addref(Z_LVAL_PP(zvalue));
|
||||||
ch->handlers->write->fp = fp;
|
ch->handlers->write->fp = fp;
|
||||||
ch->handlers->write->method = PHP_CURL_FILE;
|
ch->handlers->write->method = PHP_CURL_FILE;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1676,6 +1677,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu
|
||||||
break;
|
break;
|
||||||
case CURLOPT_WRITEHEADER:
|
case CURLOPT_WRITEHEADER:
|
||||||
if (((php_stream *) what)->mode[0] != 'r') {
|
if (((php_stream *) what)->mode[0] != 'r') {
|
||||||
|
zend_list_addref(Z_LVAL_PP(zvalue));
|
||||||
ch->handlers->write_header->fp = fp;
|
ch->handlers->write_header->fp = fp;
|
||||||
ch->handlers->write_header->method = PHP_CURL_FILE;
|
ch->handlers->write_header->method = PHP_CURL_FILE;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue