From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jelle Licht Subject: [PATCH] gnu: jq: Fix CVE-2015-8863. Date: Thu, 11 Aug 2016 17:11:02 +0200 Message-ID: <87shubtk6x.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXrdY-0004al-0U for guix-devel@gnu.org; Thu, 11 Aug 2016 11:11:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXrdT-00036M-4J for guix-devel@gnu.org; Thu, 11 Aug 2016 11:11:10 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXrdS-00036I-Uw for guix-devel@gnu.org; Thu, 11 Aug 2016 11:11:07 -0400 Received: by mail-wm0-f68.google.com with SMTP id i138so356142wmf.3 for ; Thu, 11 Aug 2016 08:11:06 -0700 (PDT) Received: from veritas ([145.129.15.220]) by smtp.gmail.com with ESMTPSA id a194sm494421wmd.24.2016.08.11.08.11.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 11 Aug 2016 08:11:04 -0700 (PDT) List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel --=-=-= Content-Type: text/plain Hello, Attached patch backports the commit[0] for jq that fixed the vulnerability referred to as CVE-2015-8863[1]. Some feedback would be welcome. - Jelle --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-gnu-jq-Fix-CVE-2015-8863.patch Content-Description: [PATCH] gnu: jq: Fix CVE-2015-8863. >From cbd181ae84003bf3cf4a2d15f44b5242dcc97860 Mon Sep 17 00:00:00 2001 From: Jelle Licht Date: Thu, 11 Aug 2016 17:02:41 +0200 Subject: [PATCH] gnu: jq: Fix CVE-2015-8863. To: guix-devel@gnu.org * gnu/packages/patches/jq-CVE-2015-8863.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/web.scm (jq): Add it. --- gnu/local.mk | 1 + gnu/packages/patches/jq-CVE-2015-8863.patch | 34 +++++++++++++++++++++++++++++ gnu/packages/web.scm | 6 ++++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/jq-CVE-2015-8863.patch diff --git a/gnu/local.mk b/gnu/local.mk index af47311..44ace61 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -595,6 +595,7 @@ dist_patch_DATA = \ %D%/packages/patches/jasper-CVE-2016-2089.patch \ %D%/packages/patches/jasper-CVE-2016-2116.patch \ %D%/packages/patches/jbig2dec-ignore-testtest.patch \ + %D%/packages/patches/jq-CVE-2015-8863.patch \ %D%/packages/patches/khmer-use-libraries.patch \ %D%/packages/patches/kmod-module-directory.patch \ %D%/packages/patches/laby-make-install.patch \ diff --git a/gnu/packages/patches/jq-CVE-2015-8863.patch b/gnu/packages/patches/jq-CVE-2015-8863.patch new file mode 100644 index 0000000..b182626 --- /dev/null +++ b/gnu/packages/patches/jq-CVE-2015-8863.patch @@ -0,0 +1,34 @@ +From 8eb1367ca44e772963e704a700ef72ae2e12babd Mon Sep 17 00:00:00 2001 +From: Nicolas Williams +Date: Sat, 24 Oct 2015 17:24:57 -0500 +Subject: [PATCH] Heap buffer overflow in tokenadd() (fix #105) + +This was an off-by one: the NUL terminator byte was not allocated on +resize. This was triggered by JSON-encoded numbers longer than 256 +bytes. +--- + jv_parse.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/jv_parse.c b/jv_parse.c +index 3102ed4..84245b8 100644 +--- a/jv_parse.c ++++ b/jv_parse.c +@@ -383,7 +383,7 @@ static pfunc stream_token(struct jv_parser* p, char ch) { + + static void tokenadd(struct jv_parser* p, char c) { + assert(p->tokenpos <= p->tokenlen); +- if (p->tokenpos == p->tokenlen) { ++ if (p->tokenpos >= (p->tokenlen - 1)) { + p->tokenlen = p->tokenlen*2 + 256; + p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen); + } +@@ -485,7 +485,7 @@ static pfunc check_literal(struct jv_parser* p) { + TRY(value(p, v)); + } else { + // FIXME: better parser +- p->tokenbuf[p->tokenpos] = 0; // FIXME: invalid ++ p->tokenbuf[p->tokenpos] = 0; + char* end = 0; + double d = jvp_strtod(&p->dtoa, p->tokenbuf, &end); + if (end == 0 || *end != 0) diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm index fa791ff..9106295 100644 --- a/gnu/packages/web.scm +++ b/gnu/packages/web.scm @@ -3293,7 +3293,11 @@ It uses the uwsgi protocol for all the networking/interprocess communications.") "/" name "-" version ".tar.gz")) (sha256 (base32 - "0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4")))) + "0g29kyz4ykasdcrb0zmbrp2jqs9kv1wz9swx849i2d1ncknbzln4")) + ;; This patch has been pushed and the vulnerability will be + ;; fixed in the next release after 1.5. + ;; https://github.com/stedolan/jq/issues/995 + (patches (search-patches "jq-CVE-2015-8863.patch")))) (inputs `(("oniguruma" ,oniguruma))) (native-inputs -- 2.9.2 --=-=-= Content-Type: text/plain [0]: https://github.com/stedolan/jq/commit/8eb1367ca44e772963e704a700ef72ae2e12babd [1]: https://access.redhat.com/security/cve/CVE-2015-8863 --=-=-=--