diff options
author | Alon Bar-Lev <alonbl@gentoo.org> | 2012-12-22 20:31:00 +0000 |
---|---|---|
committer | Alon Bar-Lev <alonbl@gentoo.org> | 2012-12-22 20:31:00 +0000 |
commit | 723d27da8e0e72e4beb52ddabf1021bab6db3a06 (patch) | |
tree | 20cce41b393d19320af207f588b357a88b90ff47 /app-crypt | |
parent | Migrate to distutils-r1. (diff) | |
download | gentoo-2-723d27da8e0e72e4beb52ddabf1021bab6db3a06.tar.gz gentoo-2-723d27da8e0e72e4beb52ddabf1021bab6db3a06.tar.bz2 gentoo-2-723d27da8e0e72e4beb52ddabf1021bab6db3a06.zip |
Fix CVE-2012-4527, CVE-2012-4426 per bug#440778
(Portage version: 2.2.0_alpha149/cvs/Linux x86_64, unsigned Manifest commit)
Diffstat (limited to 'app-crypt')
-rw-r--r-- | app-crypt/mcrypt/ChangeLog | 7 | ||||
-rw-r--r-- | app-crypt/mcrypt/files/mcrypt-2.6.8-format-string.patch | 31 | ||||
-rw-r--r-- | app-crypt/mcrypt/files/mcrypt-2.6.8-sprintf.patch | 114 | ||||
-rw-r--r-- | app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild | 4 |
4 files changed, 154 insertions, 2 deletions
diff --git a/app-crypt/mcrypt/ChangeLog b/app-crypt/mcrypt/ChangeLog index 79a59774c5f8..880d2d6c776f 100644 --- a/app-crypt/mcrypt/ChangeLog +++ b/app-crypt/mcrypt/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for app-crypt/mcrypt # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/app-crypt/mcrypt/ChangeLog,v 1.35 2012/12/22 20:12:50 alonbl Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-crypt/mcrypt/ChangeLog,v 1.36 2012/12/22 20:31:00 alonbl Exp $ + + 22 Dec 2012; Alon Bar-Lev <alonbl@gentoo.org> + +files/mcrypt-2.6.8-format-string.patch, +files/mcrypt-2.6.8-sprintf.patch, + mcrypt-2.6.8-r2.ebuild: + Fix CVE-2012-4527, CVE-2012-4426 per bug#440778 *mcrypt-2.6.8-r2 (22 Dec 2012) diff --git a/app-crypt/mcrypt/files/mcrypt-2.6.8-format-string.patch b/app-crypt/mcrypt/files/mcrypt-2.6.8-format-string.patch new file mode 100644 index 000000000000..d602bed46bfe --- /dev/null +++ b/app-crypt/mcrypt/files/mcrypt-2.6.8-format-string.patch @@ -0,0 +1,31 @@ +--- src/errors.c ++++ src/errors.c +@@ -25,24 +25,24 @@ + + void err_quit(char *errmsg) + { +- fprintf(stderr, errmsg); ++ fprintf(stderr, "%s", errmsg); + exit(-1); + } + + void err_warn(char *errmsg) + { + if (quiet <= 1) +- fprintf(stderr, errmsg); ++ fprintf(stderr, "%s", errmsg); + } + + void err_info(char *errmsg) + { + if (quiet == 0) +- fprintf(stderr, errmsg); ++ fprintf(stderr, "%s", errmsg); + } + + void err_crit(char *errmsg) + { + if (quiet <= 2) +- fprintf(stderr, errmsg); ++ fprintf(stderr, "%s", errmsg); + } diff --git a/app-crypt/mcrypt/files/mcrypt-2.6.8-sprintf.patch b/app-crypt/mcrypt/files/mcrypt-2.6.8-sprintf.patch new file mode 100644 index 000000000000..9678192b6108 --- /dev/null +++ b/app-crypt/mcrypt/files/mcrypt-2.6.8-sprintf.patch @@ -0,0 +1,114 @@ +Description: [CVE-2012-4527] Stack-based buffer overflow with long file names + . + A buffer overflow in mcrypt version 2.6.8 and earlier due to long filenames. + If a user were tricked into attempting to encrypt/decrypt specially crafted + long filename(s), this flaw would cause a stack-based buffer overflow that + could potentially lead to arbitrary code execution. + . + Note that this is caught by FORTIFY_SOURCE, which makes this a crash-only + bug on wheezy. +Author: Attila Bogar, Jean-Michel Vourgère <jmv_deb@nirgal.com> +Origin: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-4527 +Bug: CVE-2012-4527 +Bug-Debian: http://bugs.debian.org/690924 +Forwarded: no +Last-Update: 2012-11-01 +Index: mcrypt-2.6.8/src/mcrypt.c +=================================================================== +--- mcrypt-2.6.8.orig/src/mcrypt.c ++++ mcrypt-2.6.8/src/mcrypt.c +@@ -41,10 +41,13 @@ + # include <time.h> + #endif + ++/* Temporary error message can contain one file name and 1k of text */ ++#define ERRWIDTH ((PATH_MAX)+1024) ++ + static char rcsid[] = + "$Id: mcrypt-2.6.8-sprintf.patch,v 1.1 2012/12/22 20:31:00 alonbl Exp $"; + +-char tmperr[128]; ++char tmperr[ERRWIDTH]; + unsigned int stream_flag = FALSE; + char *keymode = NULL; + char *mode = NULL; +@@ -482,7 +485,7 @@ + #ifdef HAVE_STAT + if (stream_flag == FALSE) { + if (is_normal_file(file[i]) == FALSE) { +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("%s: %s is not a regular file. Skipping...\n"), + program_name, file[i]); +@@ -501,7 +504,7 @@ + dinfile = file[i]; + if ((isatty(fileno((FILE *) (stdin))) == 1) + && (stream_flag == TRUE) && (force == 0)) { /* not a tty */ +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("%s: Encrypted data will not be read from a terminal.\n"), + program_name); +@@ -520,7 +523,7 @@ + einfile = file[i]; + if ((isatty(fileno((FILE *) (stdout))) == 1) + && (stream_flag == TRUE) && (force == 0)) { /* not a tty */ +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("%s: Encrypted data will not be written to a terminal.\n"), + program_name); +@@ -544,7 +547,7 @@ + strcpy(outfile, einfile); + /* if file has already the .nc ignore it */ + if (strstr(outfile, ".nc") != NULL) { +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("%s: file %s has the .nc suffix... skipping...\n"), + program_name, outfile); +@@ -590,10 +593,10 @@ + + if (x == 0) { + if (stream_flag == FALSE) { +- sprintf(tmperr, _("File %s was decrypted.\n"), dinfile); ++ snprintf(tmperr, ERRWIDTH, _("File %s was decrypted.\n"), dinfile); + err_warn(tmperr); + } else { +- sprintf(tmperr, _("Stdin was decrypted.\n")); ++ snprintf(tmperr, ERRWIDTH, _("Stdin was decrypted.\n")); + err_warn(tmperr); + } + #ifdef HAVE_STAT +@@ -610,7 +613,7 @@ + + } else { + if (stream_flag == FALSE) { +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("File %s was NOT decrypted successfully.\n"), + dinfile); +@@ -636,10 +639,10 @@ + + if (x == 0) { + if (stream_flag == FALSE) { +- sprintf(tmperr, _("File %s was encrypted.\n"), einfile); ++ snprintf(tmperr, ERRWIDTH, _("File %s was encrypted.\n"), einfile); + err_warn(tmperr); + } else { +- sprintf(tmperr, _("Stdin was encrypted.\n")); ++ snprintf(tmperr, ERRWIDTH, _("Stdin was encrypted.\n")); + err_warn(tmperr); + } + #ifdef HAVE_STAT +@@ -655,7 +658,7 @@ + + } else { + if (stream_flag == FALSE) { +- sprintf(tmperr, ++ snprintf(tmperr, ERRWIDTH, + _ + ("File %s was NOT encrypted successfully.\n"), + einfile); diff --git a/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild b/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild index 532cfaf8781f..139ad89bde64 100644 --- a/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild +++ b/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild,v 1.1 2012/12/22 20:12:50 alonbl Exp $ +# $Header: /var/cvsroot/gentoo-x86/app-crypt/mcrypt/mcrypt-2.6.8-r2.ebuild,v 1.2 2012/12/22 20:31:00 alonbl Exp $ EAPI="2" @@ -24,6 +24,8 @@ src_prepare() { epatch "${FILESDIR}/${PN}-2.6.7-qa.patch" epatch "${FILESDIR}/${P}-stdlib.h.patch" epatch "${FILESDIR}/${P}-segv.patch" + epatch "${FILESDIR}/${P}-sprintf.patch" + epatch "${FILESDIR}/${P}-format-string.patch" } src_configure() { |