summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-08-18 22:49:10 -0700
committerStanislav Malyshev <stas@php.net>2014-08-18 22:49:10 -0700
commit706aefb78112a44d4932d4c9430c6a898696f51f (patch)
tree6fc760a5341fbc6814009a6043b5038d53675887 /ext
parent529da0f74c1a230d0656799efc73a387392dbc10 (diff)
downloadphp-git-706aefb78112a44d4932d4c9430c6a898696f51f.tar.gz
Fix bug #67730 - Null byte injection possible with imagexxx functions
Diffstat (limited to 'ext')
-rw-r--r--ext/gd/gd_ctx.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
index bff691fad2..eafbab5896 100644
--- a/ext/gd/gd_ctx.c
+++ b/ext/gd/gd_ctx.c
@@ -124,6 +124,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
RETURN_FALSE;
}
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
+ if (CHECK_ZVAL_NULL_PATH(to_zval)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
+ RETURN_FALSE;
+ }
+
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
if (stream == NULL) {
RETURN_FALSE;