svn: /php/php-src/ branches/PHP_5_2/ext/standard/http_fopen_wrapper.c branches/PHP_5_3/ext/standard/http_fopen_wrapper.c
trunk/ext/standard/http_fopen_wrapper.c

From: Date: Tue, 04 Aug 2009 09:24:48 +0000
Subject: svn: /php/php-src/ branches/PHP_5_2/ext/standard/http_fopen_wrapper.c branches/PHP_5_3/ext/standard/http_fopen_wrapper.c
trunk/ext/standard/http_fopen_wrapper.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-60012@lists.php.net to get a copy of this message
tony2001 Tue, 04 Aug 2009 09:24:48 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=286790 Log: fix memleak and possible segfault in HTTP fopen wrapper Changed paths: U php/php-src/branches/PHP_5_2/ext/standard/http_fopen_wrapper.c U php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c U php/php-src/trunk/ext/standard/http_fopen_wrapper.c Modified: php/php-src/branches/PHP_5_2/ext/standard/http_fopen_wrapper.c =================================================================== --- php/php-src/branches/PHP_5_2/ext/standard/http_fopen_wrapper.c 2009-08-04 06:07:46 UTC (rev 286789) +++ php/php-src/branches/PHP_5_2/ext/standard/http_fopen_wrapper.c 2009-08-04 09:24:48 UTC (rev 286790) @@ -347,7 +347,10 @@ } smart_str_0(&tmpstr); /* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */ - tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + if (tmpstr.c) { + tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + smart_str_free(&tmpstr); + } } if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ Modified: php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c =================================================================== --- php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c 2009-08-04 06:07:46 UTC (rev 286789) +++ php/php-src/branches/PHP_5_3/ext/standard/http_fopen_wrapper.c 2009-08-04 09:24:48 UTC (rev 286790) @@ -348,7 +348,10 @@ } smart_str_0(&tmpstr); /* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */ - tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + if (tmpstr.c) { + tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + smart_str_free(&tmpstr); + } } if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */ Modified: php/php-src/trunk/ext/standard/http_fopen_wrapper.c =================================================================== --- php/php-src/trunk/ext/standard/http_fopen_wrapper.c 2009-08-04 06:07:46 UTC (rev 286789) +++ php/php-src/trunk/ext/standard/http_fopen_wrapper.c 2009-08-04 09:24:48 UTC (rev 286790) @@ -391,7 +391,10 @@ } smart_str_0(&tmpstr); /* Remove newlines and spaces from start and end. there's at least one extra \r\n at the end that needs to go. */ - tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + if (tmpstr.c) { + tmp = php_trim(tmpstr.c, strlen(tmpstr.c), NULL, 0, NULL, 3 TSRMLS_CC); + smart_str_free(&tmpstr); + } } if (Z_TYPE_PP(tmpzval) == IS_STRING && Z_STRLEN_PP(tmpzval)) { /* Remove newlines and spaces from start and end php_trim will estrndup() */

« previous php.cvs (#60012) next »