From 4e8cda10251d704d2d702af51922d864703bf9ca0a4f47c94fe6975d8333c1d6 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 28 Nov 2017 19:13:01 +0000 Subject: [PATCH] Accepting request 546270 from home:kstreitova:branches:Archiving - add zip-3.0-fix-memory_leaks.patch to fix memory leaks in zip.c, zipfile.c and fileio.c files [bsc#1068346] OBS-URL: https://build.opensuse.org/request/show/546270 OBS-URL: https://build.opensuse.org/package/show/Archiving/zip?expand=0&rev=17 --- zip-3.0-fix-memory_leaks.patch | 65 ++++++++++++++++++++++++++++++++++ zip.changes | 6 ++++ zip.spec | 5 ++- 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 zip-3.0-fix-memory_leaks.patch diff --git a/zip-3.0-fix-memory_leaks.patch b/zip-3.0-fix-memory_leaks.patch new file mode 100644 index 0000000..ac4aa72 --- /dev/null +++ b/zip-3.0-fix-memory_leaks.patch @@ -0,0 +1,65 @@ +--- zipfile.c ++++ zipfile.c +@@ -2166,7 +2166,7 @@ int readlocal(localz, z) + #ifndef UTIL + ulg start_disk = 0; + uzoff_t start_offset = 0; +- char *split_path; ++ char *split_path = NULL; + + start_disk = z->dsk; + start_offset = z->off; +@@ -2197,6 +2197,7 @@ int readlocal(localz, z) + split_path = get_in_split_path(in_path, start_disk); + } + } ++ if (split_path) free(split_path); + #endif + + /* For utilities assume archive is on one disk for now */ +@@ -6014,7 +6015,7 @@ int zipcopy(z) + ulg e = 0; /* extended local header size */ + ulg start_disk = 0; + uzoff_t start_offset = 0; +- char *split_path; ++ char *split_path = NULL; + char buf[LOCHEAD + 1]; + struct zlist far *localz; + int r; +@@ -6063,6 +6064,7 @@ int zipcopy(z) + split_path = get_in_split_path(in_path, start_disk); + } + } ++ if (split_path) free(split_path); + + if (zfseeko(in_file, start_offset, SEEK_SET) != 0) { + fclose(in_file); +--- zip.c ++++ zip.c +@@ -3450,6 +3450,7 @@ char **argv; /* command line + } + } + */ ++ free(value); /* Added by Polo from forum */ + if (kk == 3) { + first_listarg = argnum; + kk = 4; +--- fileio.c ++++ fileio.c +@@ -696,6 +696,7 @@ int newnamew(namew, isdir, casesensitive + return ZE_MEM; + } + strcpy(z->name, name); ++ if (z->oname) free(z->oname); + z->oname = oname; + oname = NULL; + z->dosflag = dosflag; +@@ -959,6 +960,7 @@ int newname(name, isdir, casesensitive) + return ZE_MEM; + } + strcpy(z->name, name); ++ if (z->oname) free(z->oname); + z->oname = oname; + z->dosflag = dosflag; + + diff --git a/zip.changes b/zip.changes index 5510782..67321bb 100644 --- a/zip.changes +++ b/zip.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Nov 28 16:29:02 UTC 2017 - kstreitova@suse.com + +- add zip-3.0-fix-memory_leaks.patch to fix memory leaks in zip.c, + zipfile.c and fileio.c files [bsc#1068346] + ------------------------------------------------------------------- Thu Jun 18 10:00:00 UTC 2015 - hsk@imb-jena.de diff --git a/zip.spec b/zip.spec index e93f0ec..ac80314 100644 --- a/zip.spec +++ b/zip.spec @@ -1,7 +1,7 @@ # # spec file for package zip # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -32,6 +32,8 @@ Patch5: zip-3.0-optflags.patch Patch6: zip-3.0-tempfile.patch Patch7: zip-notimestamp.patch Patch8: zip-3.0-nomutilation.patch +# PATCH-FIX-UPSTREAM bsc#1068346 kstreitova@suse.com -- fix memory leaks +Patch9: zip-3.0-fix-memory_leaks.patch Provides: crzip = %{version} Obsoletes: crzip < %{version} BuildRequires: libbz2-devel @@ -50,6 +52,7 @@ PKZIP(tm) 2.04g (Phil Katz ZIP) for MS-DOS systems. %patch6 %patch7 %patch8 +%patch9 %build make %{?_smp_mflags} -f unix/Makefile prefix=/usr CC="gcc %{optflags} -DLARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64" generic_gcc