tony2001 Fri Feb 23 20:53:24 2007 UTC
Modified files: (Branch: PHP_4_4)
/php-src NEWS
/php-src/ext/curl curl.c
Log:
fix #40611 (possible cURL memory error)
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.1247.2.920.2.198&r2=1.1247.2.920.2.199&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.198 php-src/NEWS:1.1247.2.920.2.199
--- php-src/NEWS:1.1247.2.920.2.198 Thu Feb 22 14:47:29 2007
+++ php-src/NEWS Fri Feb 23 20:53:23 2007
@@ -2,6 +2,8 @@
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Feb 2007, Version 4.4.6
+- Fixed bug #40611 (possible cURL memory error). (Tony)
+
22 Feb 2007, Version 4.4.6RC1
- Updated PCRE to version 7.0. (Nuno)
http://cvs.php.net/viewvc.cgi/php-src/ext/curl/curl.c?r1=1.124.2.30.2.16&r2=1.124.2.30.2.17&diff_format=u
Index: php-src/ext/curl/curl.c
diff -u php-src/ext/curl/curl.c:1.124.2.30.2.16
php-src/ext/curl/curl.c:1.124.2.30.2.17
--- php-src/ext/curl/curl.c:1.124.2.30.2.16 Fri Jan 12 16:38:40 2007
+++ php-src/ext/curl/curl.c Fri Feb 23 20:53:24 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: curl.c,v 1.124.2.30.2.16 2007/01/12 16:38:40 iliaa Exp $ */
+/* $Id: curl.c,v 1.124.2.30.2.17 2007/02/23 20:53:24 tony2001 Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -559,7 +559,9 @@
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
case PHP_CURL_RETURN:
- smart_str_appendl(&t->buf, data, (int) length);
+ if (length > 0) {
+ smart_str_appendl(&t->buf, data, (int) length);
+ }
break;
case PHP_CURL_USER: {
zval *argv[2];
@@ -674,10 +676,11 @@
case PHP_CURL_STDOUT:
/* Handle special case write when we're returning the
entire transfer
*/
- if (ch->handlers->write->method == PHP_CURL_RETURN)
+ if (ch->handlers->write->method == PHP_CURL_RETURN &&
length > 0) {
smart_str_appendl(&ch->handlers->write->buf,
data, (int) length);
- else
+ } else {
PHPWRITE(data, length);
+ }
break;
case PHP_CURL_FILE:
return fwrite(data, size, nmemb, t->fp);
@@ -1309,7 +1312,7 @@
}
--ch->uses;
if (ch->handlers->write->method == PHP_CURL_RETURN) {
- RETURN_STRINGL("", sizeof("") - 1, 0);
+ RETURN_EMPTY_STRING();
}
RETURN_TRUE;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php