]> granicus.if.org Git - php/commitdiff
MFH: fix bug #48518 (curl crashes when writing into invalid file handle)
authorAntony Dovgal <tony2001@php.net>
Thu, 11 Jun 2009 09:46:43 +0000 (09:46 +0000)
committerAntony Dovgal <tony2001@php.net>
Thu, 11 Jun 2009 09:46:43 +0000 (09:46 +0000)
ext/curl/interface.c

index 075f5b8b911064016aa81c3ea6474cf90a02ff44..0470e4890fa0899a2275b6486b9b006c2b1cae0f 100644 (file)
@@ -1650,6 +1650,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 {
@@ -1660,6 +1661,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 {