From: Antony Dovgal Date: Thu, 11 Jun 2009 09:46:27 +0000 (+0000) Subject: fix bug #48518 (curl crashes when writing into invalid file handle) X-Git-Tag: php-5.4.0alpha1~191^2~3358 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c6cd73e7d1a8e39802c44f1ffa693b9d00de3b57;p=php fix bug #48518 (curl crashes when writing into invalid file handle) --- diff --git a/ext/curl/interface.c b/ext/curl/interface.c index 929259ea8c..74e092ebea 100644 --- a/ext/curl/interface.c +++ b/ext/curl/interface.c @@ -1666,6 +1666,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu switch (option) { case CURLOPT_FILE: if (((php_stream *) what)->mode[0] != 'r') { + zend_list_addref(Z_LVAL_PP(zvalue)); ch->handlers->write->fp = fp; ch->handlers->write->method = PHP_CURL_FILE; } else { @@ -1676,6 +1677,7 @@ static int _php_curl_setopt(php_curl *ch, long option, zval **zvalue, zval *retu break; case CURLOPT_WRITEHEADER: if (((php_stream *) what)->mode[0] != 'r') { + zend_list_addref(Z_LVAL_PP(zvalue)); ch->handlers->write_header->fp = fp; ch->handlers->write_header->method = PHP_CURL_FILE; } else {