summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2010-12-14 17:00:36 +0000
committerIlia Alshanetsky <iliaa@php.net>2010-12-14 17:00:36 +0000
commit9c30a3398a51941de966ed700933d794e41a0afb (patch)
tree1f2cb724d4679ce15559d57744ea6ce5f9a0d054
parentab80d4e4b7993f06ef9845a5c0e46bcad73023ef (diff)
downloadphp-git-9c30a3398a51941de966ed700933d794e41a0afb.tar.gz
Fixed bug #53541 (format string bug in ext/phar).
-rw-r--r--ext/phar/stream.c2
-rwxr-xr-xmain/php_streams.h14
2 files changed, 12 insertions, 4 deletions
diff --git a/ext/phar/stream.c b/ext/phar/stream.c
index 1fbbbb1b54..f037fa8fa5 100644
--- a/ext/phar/stream.c
+++ b/ext/phar/stream.c
@@ -250,7 +250,7 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, char *pat
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;
diff --git a/main/php_streams.h b/main/php_streams.h
index 87da9bc95a..b9aac4d879 100755
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -299,7 +299,12 @@ PHPAPI size_t _php_stream_write(php_stream *stream, const char *buf, size_t coun
#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,8 +560,11 @@ PHPAPI char *php_stream_locate_eol(php_stream *stream, char *buf, size_t buf_len
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 */