Re: cvs: php-src /ext/curl interface.c
| From: | Sterling Hughes | Date: | Fri, 12 Mar 2004 16:10:31 +0000 |
| Subject: | Re: cvs: php-src /ext/curl interface.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-26600@lists.php.net to get a copy of this message | ||
not a good fix, use IS_STRING to test.
-sterling
On Mar 12, 2004, at 11:08 AM, John Coggeshall wrote:
john Fri Mar 12 11:08:11 2004 EDT Modified files:/php-src/ext/curl interface.cLog: Fixed a crash which happens if your READFUNCTION callback doesn't actually return a string as promised. http://cvs.php.net/diff.php/php-src/ext/curl/interface.c?r1=1.34&r2=1.35&ty=u Index: php-src/ext/curl/interface.c diff -u php-src/ext/curl/interface.c:1.34 php-src/ext/curl/interface.c:1.35 --- php-src/ext/curl/interface.c:1.34 Wed Mar 10 19:11:18 2004 +++ php-src/ext/curl/interface.c Fri Mar 12 11:08:11 2004 @@ -16,7 +16,7 @@+----------------------------------------------------------------------+*/ -/* $Id: interface.c,v 1.34 2004/03/11 00:11:18 iliaa Exp $ */ +/* $Id: interface.c,v 1.35 2004/03/12 16:08:11 john Exp $ */ #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS @@ -500,8 +500,12 @@ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot call the CURLOPT_READFUNCTION"); length = -1; } else { - memcpy(data, Z_STRVAL_P(retval_ptr), size * nmemb); - length = Z_STRLEN_P(retval_ptr); + if(Z_STRVAL_P(retval_ptr)) { + memcpy(data, Z_STRVAL_P(retval_ptr), size * nmemb); + length = Z_STRLEN_P(retval_ptr); + } else { + data = strdup(""); + } } zval_ptr_dtor(argv[0]); --PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php