From bc879fa08ec1b3f6c79d75d10672936231d569bc Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 13 Feb 2015 08:03:04 +0100 Subject: php54-extras: upstream mcrypt security fix --- php-5.4.16-mcrypt.patch | 40 ++++++++++++++++++++++++++++++++++++++++ php-extras.spec | 12 ++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 php-5.4.16-mcrypt.patch diff --git a/php-5.4.16-mcrypt.patch b/php-5.4.16-mcrypt.patch new file mode 100644 index 0000000..3158c70 --- /dev/null +++ b/php-5.4.16-mcrypt.patch @@ -0,0 +1,40 @@ +From dd791cd71742fdb9b87b7166537fbb25bd7cd8b9 Mon Sep 17 00:00:00 2001 +From: Dmitry Stogov +Date: Mon, 8 Dec 2014 12:18:27 +0300 +Subject: [PATCH] Fixed possible read after end of buffer and use after free. + +--- + ext/mcrypt/mcrypt.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c +index 55302c7..7f463cf 100644 +--- a/ext/mcrypt/mcrypt.c ++++ b/ext/mcrypt/mcrypt.c +@@ -619,8 +619,11 @@ PHP_FUNCTION(mcrypt_generic_init) + + if (iv_len != iv_size) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size); ++ if (iv_len > iv_size) { ++ iv_len = iv_size; ++ } + } +- memcpy(iv_s, iv, iv_size); ++ memcpy(iv_s, iv, iv_len); + + mcrypt_generic_deinit(pm->td); + result = mcrypt_generic_init(pm->td, key_s, key_size, iv_s); +@@ -641,8 +644,9 @@ PHP_FUNCTION(mcrypt_generic_init) + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown error"); + break; + } ++ } else { ++ pm->init = 1; + } +- pm->init = 1; + RETVAL_LONG(result); + + efree(iv_s); +-- +2.1.4 + diff --git a/php-extras.spec b/php-extras.spec index ad167ff..a2f12a1 100644 --- a/php-extras.spec +++ b/php-extras.spec @@ -29,13 +29,16 @@ Name: %{?scl_prefix}php-extras Summary: Additional PHP modules from the standard PHP distribution Version: 5.4.16 -Release: 5%{?dist} +Release: 6%{?dist} Group: Development/Languages License: The PHP License URL: http://www.php.net/ Source0: http://www.php.net/distributions/php-%{version}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Security patches +Patch0: php-5.4.16-mcrypt.patch + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: %{?scl_prefix}php-devel >= 5.4 @@ -155,6 +158,8 @@ add support for using the enchant library to PHP. %prep %setup -q -n php-%{version} +%patch0 -p1 -b .security + # avoid tests which requires databases rm -rf ext/{mssql,pdo_dblib,interbase,pdo_firebird}/tests @@ -242,6 +247,9 @@ rm -rf %{buildroot} %changelog +* Fri Feb 13 2015 Remi Collet - 5.4.16-6 +- mcrypt upstream security fix + * Mon Jul 21 2014 Remi Collet - 5.4.16-5 - add tidy for rhel-7 -- cgit