~ruther/guix-local

bfcdf88760e6732d43c0cd1eeb0a95c5d8681950 — Alex Vong 8 years ago 3ddaa79
gnu: catdoc: Fix CVE-2017-11110.

* gnu/packages/patches/catdoc-CVE-2017-11110.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/textutils.scm (catdoc)[source]: Use it.

Signed-off-by: Marius Bakke <mbakke@fastmail.com>
3 files changed, 48 insertions(+), 0 deletions(-)

M gnu/local.mk
A gnu/packages/patches/catdoc-CVE-2017-11110.patch
M gnu/packages/textutils.scm
M gnu/local.mk => gnu/local.mk +1 -0
@@ 534,6 534,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/calibre-drop-unrar.patch			\
  %D%/packages/patches/calibre-no-updates-dialog.patch		\
  %D%/packages/patches/calibre-use-packaged-feedparser.patch	\
  %D%/packages/patches/catdoc-CVE-2017-11110.patch		\
  %D%/packages/patches/cdparanoia-fpic.patch			\
  %D%/packages/patches/cdrtools-3.01-mkisofs-isoinfo.patch 	\
  %D%/packages/patches/ceph-disable-cpu-optimizations.patch	\

A gnu/packages/patches/catdoc-CVE-2017-11110.patch => gnu/packages/patches/catdoc-CVE-2017-11110.patch +45 -0
@@ 0,0 1,45 @@
Fix CVE-2017-11110:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-11110
https://bugzilla.redhat.com/show_bug.cgi?id=1468471
https://security-tracker.debian.org/tracker/CVE-2017-11110

Patch copied from openSUSE:

https://build.opensuse.org/package/view_file/openSUSE:Maintenance:6985/catdoc.openSUSE_Leap_42.2_Update/CVE-2017-11110.patch?expand=1

From: Andreas Stieger <astieger@suse.com>
Date: Mon, 10 Jul 2017 15:37:58 +0000
References: CVE-2017-11110 http://bugzilla.suse.com/show_bug.cgi?id=1047877

All .doc I found had sectorSize 0x09 at offset 0x1e. Guarding it against <4.

---
 src/ole.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: catdoc-0.95/src/ole.c
===================================================================
--- catdoc-0.95.orig/src/ole.c	2016-05-25 06:37:12.000000000 +0200
+++ catdoc-0.95/src/ole.c	2017-07-10 17:42:33.578308107 +0200
@@ -106,6 +106,11 @@ FILE* ole_init(FILE *f, void *buffer, si
 		return NULL;
 	}
  	sectorSize = 1<<getshort(oleBuf,0x1e);
+	/* CVE-2017-11110) */
+ 	if (sectorSize < 4) {
+		fprintf(stderr,"sectorSize < 4 not supported\n");
+		return NULL;
+	}
 	shortSectorSize=1<<getshort(oleBuf,0x20);
 
 /* Read BBD into memory */
@@ -147,7 +152,7 @@ FILE* ole_init(FILE *f, void *buffer, si
 		}
 
 		fseek(newfile, 512+mblock*sectorSize, SEEK_SET);
-		if(fread(tmpBuf+MSAT_ORIG_SIZE+(sectorSize-4)*i,
+		if(fread(tmpBuf+MSAT_ORIG_SIZE+(sectorSize-4)*i, /* >= 4 for CVE-2017-11110 */
 						 1, sectorSize, newfile) != sectorSize) {
 			fprintf(stderr, "Error read MSAT!\n");
 			ole_finish();

M gnu/packages/textutils.scm => gnu/packages/textutils.scm +2 -0
@@ 12,6 12,7 @@
;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
;;; Copyright © 2017 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;; Copyright © 2017 Kei Kebreau <kei@openmailbox.org>
;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;


@@ 409,6 410,7 @@ runs Word\".")
              (method url-fetch)
              (uri (string-append "http://ftp.wagner.pp.ru/pub/catdoc/"
                                  "catdoc-" version ".tar.gz"))
              (patches (search-patches "catdoc-CVE-2017-11110.patch"))
              (sha256
               (base32
                "15h7v3bmwfk4z8r78xs5ih6vd0pskn0rj90xghvbzdjj0cc88jji"))))