Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c
On 02/18/2012 05:39 AM, Nikita Popov wrote: nikicSat, 18 Feb 2012 13:39:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=323330 Log: Fix headers generated by phar sapi_header_line.line_len is the length without null terminator, so one has to take sizeof - 1. This fixes some test failures as the NUL bytes were causing warnings. Needs to be merged to 5.4. Hi Nikita, This fix deserves a bug report - which will also help as a reminder for the 5.4 merge. And it will also add value to NEWS, since people will be able to find more information (via the bug report) than you could put in a one line NEWS entry. Chris -- Email: christopher.jo...@oracle.com Tel: +1 650 506 8630 Blog: http://blogs.oracle.com/opal/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c
nikicSat, 18 Feb 2012 13:39:13 + Revision: http://svn.php.net/viewvc?view=revisionrevision=323330 Log: Fix headers generated by phar sapi_header_line.line_len is the length without null terminator, so one has to take sizeof - 1. This fixes some test failures as the NUL bytes were causing warnings. Needs to be merged to 5.4. Changed paths: U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c U php/php-src/trunk/ext/phar/phar_object.c Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c === --- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2012-02-18 13:14:30 UTC (rev 323329) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2012-02-18 13:39:13 UTC (rev 323330) @@ -427,7 +427,7 @@ sapi_header_line ctr = {0}; ctr.response_code = 403; - ctr.line_len = sizeof(HTTP/1.0 403 Access Denied); + ctr.line_len = sizeof(HTTP/1.0 403 Access Denied)-1; ctr.line = HTTP/1.0 403 Access Denied; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); sapi_send_headers(TSRMLS_C); @@ -452,7 +452,7 @@ } ctr.response_code = 404; - ctr.line_len = sizeof(HTTP/1.0 404 Not Found)+1; + ctr.line_len = sizeof(HTTP/1.0 404 Not Found)-1; ctr.line = HTTP/1.0 404 Not Found; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); sapi_send_headers(TSRMLS_C); @@ -891,7 +891,7 @@ char *tmp = NULL, sa = '\0'; sapi_header_line ctr = {0}; ctr.response_code = 301; - ctr.line_len = sizeof(HTTP/1.1 301 Moved Permanently)+1; + ctr.line_len = sizeof(HTTP/1.1 301 Moved Permanently)-1; ctr.line = HTTP/1.1 301 Moved Permanently; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); Modified: php/php-src/trunk/ext/phar/phar_object.c === --- php/php-src/trunk/ext/phar/phar_object.c2012-02-18 13:14:30 UTC (rev 323329) +++ php/php-src/trunk/ext/phar/phar_object.c2012-02-18 13:39:13 UTC (rev 323330) @@ -428,7 +428,7 @@ sapi_header_line ctr = {0}; ctr.response_code = 403; - ctr.line_len = sizeof(HTTP/1.0 403 Access Denied); + ctr.line_len = sizeof(HTTP/1.0 403 Access Denied)-1; ctr.line = HTTP/1.0 403 Access Denied; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); sapi_send_headers(TSRMLS_C); @@ -453,7 +453,7 @@ } ctr.response_code = 404; - ctr.line_len = sizeof(HTTP/1.0 404 Not Found)+1; + ctr.line_len = sizeof(HTTP/1.0 404 Not Found)-1; ctr.line = HTTP/1.0 404 Not Found; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); sapi_send_headers(TSRMLS_C); @@ -893,7 +893,7 @@ char *tmp = NULL, sa = '\0'; sapi_header_line ctr = {0}; ctr.response_code = 301; - ctr.line_len = sizeof(HTTP/1.1 301 Moved Permanently)+1; + ctr.line_len = sizeof(HTTP/1.1 301 Moved Permanently)-1; ctr.line = HTTP/1.1 301 Moved Permanently; sapi_header_op(SAPI_HEADER_REPLACE, ctr TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c
felipe Mon, 14 Mar 2011 14:12:42 + Revision: http://svn.php.net/viewvc?view=revisionrevision=309222 Log: - Missing fixes for bug #54247 Bug: http://bugs.php.net/54247 (error getting bug information) Changed paths: U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c U php/php-src/trunk/ext/phar/phar_object.c Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c === --- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 13:54:41 UTC (rev 309221) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 14:12:42 UTC (rev 309222) @@ -307,7 +307,7 @@ char *error; if (!phar_open_jit(phar, info, error TSRMLS_CC)) { if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } return -1; @@ -673,7 +673,7 @@ if (phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) != SUCCESS) { if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } return; @@ -1095,7 +1095,7 @@ stub = phar_create_default_stub(index, webindex, stub_len, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); return; } @@ -1120,7 +1120,7 @@ RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) == SUCCESS); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } } /* }}} */ Modified: php/php-src/trunk/ext/phar/phar_object.c === --- php/php-src/trunk/ext/phar/phar_object.c2011-03-14 13:54:41 UTC (rev 309221) +++ php/php-src/trunk/ext/phar/phar_object.c2011-03-14 14:12:42 UTC (rev 309222) @@ -308,7 +308,7 @@ char *error; if (!phar_open_jit(phar, info, error TSRMLS_CC)) { if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } return -1; @@ -675,7 +675,7 @@ if (phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) != SUCCESS) { if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } return; @@ -1097,7 +1097,7 @@ stub = phar_create_default_stub(index, webindex, stub_len, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); return; } @@ -1122,7 +1122,7 @@ RETVAL_BOOL(phar_open_executed_filename(alias, alias_len, error TSRMLS_CC) == SUCCESS); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c
felipe Mon, 14 Mar 2011 13:54:41 + Revision: http://svn.php.net/viewvc?view=revisionrevision=309221 Log: - Fixed bug #54247 (format-string vulnerability on Phar) Bug: http://bugs.php.net/54247 (error getting bug information) Changed paths: U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c U php/php-src/trunk/ext/phar/phar_object.c Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c === --- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 13:53:44 UTC (rev 309220) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2011-03-14 13:54:41 UTC (rev 309221) @@ -1141,7 +1141,7 @@ RETVAL_BOOL(phar_open_from_filename(fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, error TSRMLS_CC) == SUCCESS); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } } /* }}} */ @@ -2007,7 +2007,7 @@ phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } @@ -2070,7 +2070,7 @@ phar_obj-arc.archive-ufp = pass.fp; phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } } else { @@ -2327,7 +2327,7 @@ phar_flush(phar, 0, 0, 1, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, %s, error); efree(error); efree(oldpath); return NULL; @@ -2787,7 +2787,7 @@ phar_flush(phar_obj-arc.archive, NULL, 0, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } @@ -2862,7 +2862,7 @@ efree(error); goto valid_alias; } - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); RETURN_FALSE; } @@ -2899,7 +2899,7 @@ phar_obj-arc.archive-alias = oldalias; phar_obj-arc.archive-alias_len = oldalias_len; phar_obj-arc.archive-is_temporary_alias = old_temp; - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); if (readd) { zend_hash_add((PHAR_GLOBALS-phar_alias_map), oldalias, oldalias_len, (void*)(phar_obj-arc.archive), sizeof(phar_archive_data*), NULL); } @@ -2972,7 +2972,7 @@ phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } } @@ -3021,7 +3021,7 @@ } phar_flush(phar_obj-arc.archive, (char *) zstub, len, 0, error TSRMLS_CC); if (error) { -zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); +zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } RETURN_TRUE; @@ -3037,7 +3037,7 @@ phar_flush(phar_obj-arc.archive, stub, stub_len, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } @@ -3098,7 +3098,7 @@ stub = phar_create_default_stub(index, webindex, stub_len, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, %s, error); efree(error); if (stub) { efree(stub); @@ -3120,7 +3120,7 @@ } if (error) { - zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); RETURN_FALSE; } @@ -3175,7 +3175,7 @@ phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC); if (error) { -zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, error); +zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, %s, error); efree(error); } break; @@ -3477,7 +3477,7 @@ phar_flush(phar_obj-arc.archive, 0, 0, 0, error TSRMLS_CC); if (error) { - zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, error); + zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, %s, error); efree(error); } } @@ -3517,7 +3517,7 @@
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/phar/phar_object.c trunk/ext/phar/phar_object.c
aharvey Thu, 23 Sep 2010 04:41:14 + Revision: http://svn.php.net/viewvc?view=revisionrevision=303709 Log: Fix up the vim folds in phar_object.c and add a note that the two prototypes before Phar::__construct() are actually valid and not a mistake, per bug #52909. Bug: http://bugs.php.net/52909 (Assigned) ReflectionMethod::getParameters() return incorrect number of arguments Changed paths: U php/php-src/branches/PHP_5_3/ext/phar/phar_object.c U php/php-src/trunk/ext/phar/phar_object.c Modified: php/php-src/branches/PHP_5_3/ext/phar/phar_object.c === --- php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2010-09-23 04:13:36 UTC (rev 303708) +++ php/php-src/branches/PHP_5_3/ext/phar/phar_object.c 2010-09-23 04:41:14 UTC (rev 303709) @@ -1251,8 +1251,12 @@ /* {{{ proto void Phar::__construct(string fname [, int flags [, string alias]]) * Construct a Phar archive object - * {{{ proto void PharData::__construct(string fname [[, int flags [, string alias]], int file format = Phar::TAR]) + * + * proto void PharData::__construct(string fname [[, int flags [, string alias]], int file format = Phar::TAR]) * Construct a PharData archive object + * + * This function is used as the constructor for both the Phar and PharData + * classes, hence the two prototypes above. */ PHP_METHOD(Phar, __construct) { Modified: php/php-src/trunk/ext/phar/phar_object.c === --- php/php-src/trunk/ext/phar/phar_object.c2010-09-23 04:13:36 UTC (rev 303708) +++ php/php-src/trunk/ext/phar/phar_object.c2010-09-23 04:41:14 UTC (rev 303709) @@ -1251,8 +1251,12 @@ /* {{{ proto void Phar::__construct(string fname [, int flags [, string alias]]) * Construct a Phar archive object - * {{{ proto void PharData::__construct(string fname [[, int flags [, string alias]], int file format = Phar::TAR]) + * + * proto void PharData::__construct(string fname [[, int flags [, string alias]], int file format = Phar::TAR]) * Construct a PharData archive object + * + * This function is used as the constructor for both the Phar and PharData + * classes, hence the two prototypes above. */ PHP_METHOD(Phar, __construct) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php