iliaa                                    Tue, 14 Dec 2010 17:00:36 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306367

Log:
Fixed bug #53541 (format string bug in ext/phar).

Bug: http://bugs.php.net/53541 (Open) format string bug in ext/phar
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/phar/stream.c
    U   php/php-src/branches/PHP_5_3/main/php_streams.h
    U   php/php-src/trunk/ext/phar/stream.c
    U   php/php-src/trunk/main/php_streams.h

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-12-14 15:42:22 UTC (rev 306366)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-12-14 17:00:36 UTC (rev 306367)
@@ -45,6 +45,10 @@
 - PDO PostgreSQL driver:
   . Fixed bug #53517 (segfault in pgsql_stmt_execute() when postgres is down).
     (gyp at balabit dot hu)
+
+- Phar Extension:
+  . Fixed bug #53541 (format string bug in ext/phar).
+    (crrodriguez at opensuse dot org, Ilia)

 - SPL extension:
   . Fixed bug #53515 (property_exists incorrect on ArrayObject null and 0

Modified: php/php-src/branches/PHP_5_3/ext/phar/stream.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/phar/stream.c      2010-12-14 15:42:22 UTC 
(rev 306366)
+++ php/php-src/branches/PHP_5_3/ext/phar/stream.c      2010-12-14 17:00:36 UTC 
(rev 306367)
@@ -250,7 +250,7 @@
                if (!*internal_file && (options & STREAM_OPEN_FOR_INCLUDE)) {
                        /* retrieve the stub */
                        if (FAILURE == phar_get_archive(&phar, resource->host, 
host_len, NULL, 0, NULL TSRMLS_CC)) {
-                               php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, "file %s is not a valid phar archive");
+                               php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, "file %s is not a valid phar archive", resource->host);
                                efree(internal_file);
                                php_url_free(resource);
                                return NULL;

Modified: php/php-src/branches/PHP_5_3/main/php_streams.h
===================================================================
--- php/php-src/branches/PHP_5_3/main/php_streams.h     2010-12-14 15:42:22 UTC 
(rev 306366)
+++ php/php-src/branches/PHP_5_3/main/php_streams.h     2010-12-14 17:00:36 UTC 
(rev 306367)
@@ -292,7 +292,12 @@
 #define php_stream_write_string(stream, str)   _php_stream_write(stream, str, 
strlen(str) TSRMLS_CC)
 #define php_stream_write(stream, buf, count)   _php_stream_write(stream, 
(buf), (count) TSRMLS_CC)

-PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...);
+#ifdef ZTS
+PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+#else
+PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
+#endif
+
 /* php_stream_printf macro & function require TSRMLS_CC */
 #define php_stream_printf _php_stream_printf

@@ -548,9 +553,12 @@
                        php_stream_open_wrapper_ex(Z_STRVAL_PP((zstream)), 
(mode), (options), (opened), (context)) : NULL

 /* pushes an error message onto the stack for a wrapper instance */
-PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...);
+#ifdef ZTS
+PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 4, 5);
+#else
+PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+#endif

-
 #define PHP_STREAM_UNCHANGED   0 /* orig stream was seekable anyway */
 #define PHP_STREAM_RELEASED            1 /* newstream should be used; 
origstream is no longer valid */
 #define PHP_STREAM_FAILED              2 /* an error occurred while attempting 
conversion */

Modified: php/php-src/trunk/ext/phar/stream.c
===================================================================
--- php/php-src/trunk/ext/phar/stream.c 2010-12-14 15:42:22 UTC (rev 306366)
+++ php/php-src/trunk/ext/phar/stream.c 2010-12-14 17:00:36 UTC (rev 306367)
@@ -250,7 +250,7 @@
                if (!*internal_file && (options & STREAM_OPEN_FOR_INCLUDE)) {
                        /* retrieve the stub */
                        if (FAILURE == phar_get_archive(&phar, resource->host, 
host_len, NULL, 0, NULL TSRMLS_CC)) {
-                               php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, "file %s is not a valid phar archive");
+                               php_stream_wrapper_log_error(wrapper, options 
TSRMLS_CC, "file %s is not a valid phar archive", resource->host);
                                efree(internal_file);
                                php_url_free(resource);
                                return NULL;

Modified: php/php-src/trunk/main/php_streams.h
===================================================================
--- php/php-src/trunk/main/php_streams.h        2010-12-14 15:42:22 UTC (rev 
306366)
+++ php/php-src/trunk/main/php_streams.h        2010-12-14 17:00:36 UTC (rev 
306367)
@@ -299,7 +299,12 @@
 #define php_stream_write_string(stream, str)   _php_stream_write(stream, str, 
strlen(str) TSRMLS_CC)
 #define php_stream_write(stream, buf, count)   _php_stream_write(stream, 
(buf), (count) TSRMLS_CC)

-PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...);
+#ifdef ZTS
+PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+#else
+PHPAPI size_t _php_stream_printf(php_stream *stream TSRMLS_DC, const char 
*fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
+#endif
+
 /* php_stream_printf macro & function require TSRMLS_CC */
 #define php_stream_printf _php_stream_printf

@@ -555,9 +560,12 @@
                        php_stream_open_wrapper_ex(Z_STRVAL_PP((zstream)), 
(mode), (options), (opened), (context)) : NULL

 /* pushes an error message onto the stack for a wrapper instance */
-PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...);
+#ifdef ZTS
+PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 4, 5);
+#else
+PHPAPI void php_stream_wrapper_log_error(php_stream_wrapper *wrapper, int 
options TSRMLS_DC, const char *fmt, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4);
+#endif

-
 #define PHP_STREAM_UNCHANGED   0 /* orig stream was seekable anyway */
 #define PHP_STREAM_RELEASED            1 /* newstream should be used; 
origstream is no longer valid */
 #define PHP_STREAM_FAILED              2 /* an error occurred while attempting 
conversion */

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to