Blame SOURCES/php-5.5.6-CVE-2014-5120.patch

e9ca13
From 1daa4c0090b7cd8178dcaa96287234c69ac6ca18 Mon Sep 17 00:00:00 2001
e9ca13
From: Stanislav Malyshev <stas@php.net>
e9ca13
Date: Mon, 18 Aug 2014 22:49:10 -0700
e9ca13
Subject: [PATCH] Fix bug #67730 - Null byte injection possible with imagexxx
e9ca13
 functions
e9ca13
e9ca13
---
e9ca13
 ext/gd/gd_ctx.c | 5 +++++
e9ca13
 1 file changed, 5 insertions(+)
e9ca13
e9ca13
diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c
e9ca13
index 59eff80..253b664 100644
e9ca13
--- a/ext/gd/gd_ctx.c
e9ca13
+++ b/ext/gd/gd_ctx.c
e9ca13
@@ -124,6 +124,11 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type,
e9ca13
 				RETURN_FALSE;
e9ca13
 			}
e9ca13
 		} else if (Z_TYPE_P(to_zval) == IS_STRING) {
e9ca13
+			if (CHECK_ZVAL_NULL_PATH(to_zval)) {
e9ca13
+				php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
e9ca13
+				RETURN_FALSE;
e9ca13
+			}
e9ca13
+
e9ca13
 			stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
e9ca13
 			if (stream == NULL) {
e9ca13
 				RETURN_FALSE;
e9ca13
-- 
e9ca13
1.9.2
e9ca13