com php-src: Fix bug #67730 - Null byte injection possible with imagexxx functions: ext/gd/gd_ctx.c

From: Date: Wed, 27 Aug 2014 02:29:28 +0000
Subject: com php-src: Fix bug #67730 - Null byte injection possible with imagexxx functions: ext/gd/gd_ctx.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81182@lists.php.net to get a copy of this message
Commit: c9da6430d37326e866ccae28aa5a4f835a459071 Author: Stanislav Malyshev <stas@php.net> Mon, 18 Aug 2014 22:49:10 -0700 Committer: Ferenc Kovacs <tyrael@php.net> Wed, 27 Aug 2014 04:29:28 +0200 Parents: d18dd11cbdf2b359fd2fdb9eb8cea94a81cbc866 Branches: PHP-5.6.0 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c9da6430d37326e866ccae28aa5a4f835a459071 Log: Fix bug #67730 - Null byte injection possible with imagexxx functions Bugs: https://bugs.php.net/67730 Changed paths: M ext/gd/gd_ctx.c Diff: diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 59eff80..253b664 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;

« previous php.cvs (#81182) next »