Change-Id: Iaf67602d602855acdbcedc4a48d5a99251f5daae
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1422
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1432
Reviewed-by: suezzelur <anishs@vmware.com>
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,398 @@ |
0 |
+From: Giovanni Scafora <giovanni.archlinux.org> |
|
1 |
+Subject: unzip files encoded with non-latin, non-unicode file names |
|
2 |
+Last-Update: 2015-02-11 |
|
3 |
+ |
|
4 |
+Updated 2015-02-11 by Marc Deslauriers <marc.deslauriers@canonical.com> |
|
5 |
+to fix buffer overflow in charset_to_intern() |
|
6 |
+ |
|
7 |
+Index: unzip-6.0/unix/unix.c |
|
8 |
+=================================================================== |
|
9 |
+--- unzip-6.0.orig/unix/unix.c 2015-02-11 08:46:43.675324290 -0500 |
|
10 |
+@@ -30,6 +30,9 @@ |
|
11 |
+ #define UNZIP_INTERNAL |
|
12 |
+ #include "unzip.h" |
|
13 |
+ |
|
14 |
++#include <iconv.h> |
|
15 |
++#include <langinfo.h> |
|
16 |
++ |
|
17 |
+ #ifdef SCO_XENIX |
|
18 |
+ # define SYSNDIR |
|
19 |
+ #else /* SCO Unix, AIX, DNIX, TI SysV, Coherent 4.x, ... */ |
|
20 |
+@@ -1874,3 +1877,102 @@ |
|
21 |
+ } |
|
22 |
+ } |
|
23 |
+ #endif /* QLZIP */ |
|
24 |
++ |
|
25 |
++ |
|
26 |
++typedef struct { |
|
27 |
++ char *local_charset; |
|
28 |
++ char *archive_charset; |
|
29 |
++} CHARSET_MAP; |
|
30 |
++ |
|
31 |
++/* A mapping of local <-> archive charsets used by default to convert filenames |
|
32 |
++ * of DOS/Windows Zip archives. Currently very basic. */ |
|
33 |
++static CHARSET_MAP dos_charset_map[] = { |
|
34 |
++ { "ANSI_X3.4-1968", "CP850" }, |
|
35 |
++ { "ISO-8859-1", "CP850" }, |
|
36 |
++ { "CP1252", "CP850" }, |
|
37 |
++ { "UTF-8", "CP866" }, |
|
38 |
++ { "KOI8-R", "CP866" }, |
|
39 |
++ { "KOI8-U", "CP866" }, |
|
40 |
++ { "ISO-8859-5", "CP866" } |
|
41 |
++}; |
|
42 |
++ |
|
43 |
++char OEM_CP[MAX_CP_NAME] = ""; |
|
44 |
++char ISO_CP[MAX_CP_NAME] = ""; |
|
45 |
++ |
|
46 |
++/* Try to guess the default value of OEM_CP based on the current locale. |
|
47 |
++ * ISO_CP is left alone for now. */ |
|
48 |
++void init_conversion_charsets() |
|
49 |
++{ |
|
50 |
++ const char *local_charset; |
|
51 |
++ int i; |
|
52 |
++ |
|
53 |
++ /* Make a guess only if OEM_CP not already set. */ |
|
54 |
++ if(*OEM_CP == '\0') { |
|
55 |
++ local_charset = nl_langinfo(CODESET); |
|
56 |
++ for(i = 0; i < sizeof(dos_charset_map)/sizeof(CHARSET_MAP); i++) |
|
57 |
++ if(!strcasecmp(local_charset, dos_charset_map[i].local_charset)) { |
|
58 |
++ strncpy(OEM_CP, dos_charset_map[i].archive_charset, |
|
59 |
++ sizeof(OEM_CP)); |
|
60 |
++ break; |
|
61 |
++ } |
|
62 |
++ } |
|
63 |
++} |
|
64 |
++ |
|
65 |
++/* Convert a string from one encoding to the current locale using iconv(). |
|
66 |
++ * Be as non-intrusive as possible. If error is encountered during covertion |
|
67 |
++ * just leave the string intact. */ |
|
68 |
++static void charset_to_intern(char *string, char *from_charset) |
|
69 |
++{ |
|
70 |
++ iconv_t cd; |
|
71 |
++ char *s,*d, *buf; |
|
72 |
++ size_t slen, dlen, buflen; |
|
73 |
++ const char *local_charset; |
|
74 |
++ |
|
75 |
++ if(*from_charset == '\0') |
|
76 |
++ return; |
|
77 |
++ |
|
78 |
++ buf = NULL; |
|
79 |
++ local_charset = nl_langinfo(CODESET); |
|
80 |
++ |
|
81 |
++ if((cd = iconv_open(local_charset, from_charset)) == (iconv_t)-1) |
|
82 |
++ return; |
|
83 |
++ |
|
84 |
++ slen = strlen(string); |
|
85 |
++ s = string; |
|
86 |
++ |
|
87 |
++ /* Make sure OUTBUFSIZ + 1 never ends up smaller than FILNAMSIZ |
|
88 |
++ * as this function also gets called with G.outbuf in fileio.c |
|
89 |
++ */ |
|
90 |
++ buflen = FILNAMSIZ; |
|
91 |
++ if (OUTBUFSIZ + 1 < FILNAMSIZ) |
|
92 |
++ { |
|
93 |
++ buflen = OUTBUFSIZ + 1; |
|
94 |
++ } |
|
95 |
++ |
|
96 |
++ d = buf = malloc(buflen); |
|
97 |
++ if(!d) |
|
98 |
++ goto cleanup; |
|
99 |
++ |
|
100 |
++ bzero(buf,buflen); |
|
101 |
++ dlen = buflen - 1; |
|
102 |
++ |
|
103 |
++ if(iconv(cd, &s, &slen, &d, &dlen) == (size_t)-1) |
|
104 |
++ goto cleanup; |
|
105 |
++ strncpy(string, buf, buflen); |
|
106 |
++ |
|
107 |
++ cleanup: |
|
108 |
++ free(buf); |
|
109 |
++ iconv_close(cd); |
|
110 |
++} |
|
111 |
++ |
|
112 |
++/* Convert a string from OEM_CP to the current locale charset. */ |
|
113 |
++inline void oem_intern(char *string) |
|
114 |
++{ |
|
115 |
++ charset_to_intern(string, OEM_CP); |
|
116 |
++} |
|
117 |
++ |
|
118 |
++/* Convert a string from ISO_CP to the current locale charset. */ |
|
119 |
++inline void iso_intern(char *string) |
|
120 |
++{ |
|
121 |
++ charset_to_intern(string, ISO_CP); |
|
122 |
++} |
|
123 |
+Index: unzip-6.0/unix/unxcfg.h |
|
124 |
+=================================================================== |
|
125 |
+--- unzip-6.0.orig/unix/unxcfg.h 2015-02-11 08:46:43.675324290 -0500 |
|
126 |
+@@ -228,4 +228,30 @@ |
|
127 |
+ /* wild_dir, dirname, wildname, matchname[], dirnamelen, have_dirname, */ |
|
128 |
+ /* and notfirstcall are used by do_wild(). */ |
|
129 |
+ |
|
130 |
++ |
|
131 |
++#define MAX_CP_NAME 25 |
|
132 |
++ |
|
133 |
++#ifdef SETLOCALE |
|
134 |
++# undef SETLOCALE |
|
135 |
++#endif |
|
136 |
++#define SETLOCALE(category, locale) setlocale(category, locale) |
|
137 |
++#include <locale.h> |
|
138 |
++ |
|
139 |
++#ifdef _ISO_INTERN |
|
140 |
++# undef _ISO_INTERN |
|
141 |
++#endif |
|
142 |
++#define _ISO_INTERN(str1) iso_intern(str1) |
|
143 |
++ |
|
144 |
++#ifdef _OEM_INTERN |
|
145 |
++# undef _OEM_INTERN |
|
146 |
++#endif |
|
147 |
++#ifndef IZ_OEM2ISO_ARRAY |
|
148 |
++# define IZ_OEM2ISO_ARRAY |
|
149 |
++#endif |
|
150 |
++#define _OEM_INTERN(str1) oem_intern(str1) |
|
151 |
++ |
|
152 |
++void iso_intern(char *); |
|
153 |
++void oem_intern(char *); |
|
154 |
++void init_conversion_charsets(void); |
|
155 |
++ |
|
156 |
+ #endif /* !__unxcfg_h */ |
|
157 |
+Index: unzip-6.0/unzip.c |
|
158 |
+=================================================================== |
|
159 |
+--- unzip-6.0.orig/unzip.c 2015-02-11 08:46:43.675324290 -0500 |
|
160 |
+@@ -327,11 +327,21 @@ |
|
161 |
+ -2 just filenames but allow -h/-t/-z -l long Unix \"ls -l\" format\n\ |
|
162 |
+ -v verbose, multi-page format\n"; |
|
163 |
+ |
|
164 |
++#ifndef UNIX |
|
165 |
+ static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\ |
|
166 |
+ -h print header line -t print totals for listed files or for all\n\ |
|
167 |
+ -z print zipfile comment -T print file times in sortable decimal format\ |
|
168 |
+ \n -C be case-insensitive %s\ |
|
169 |
+ -x exclude filenames that follow from listing\n"; |
|
170 |
++#else /* UNIX */ |
|
171 |
++static ZCONST char Far ZipInfoUsageLine3[] = "miscellaneous options:\n\ |
|
172 |
++ -h print header line -t print totals for listed files or for all\n\ |
|
173 |
++ -z print zipfile comment %c-T%c print file times in sortable decimal format\ |
|
174 |
++\n %c-C%c be case-insensitive %s\ |
|
175 |
++ -x exclude filenames that follow from listing\n\ |
|
176 |
++ -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives\n\ |
|
177 |
++ -I CHARSET specify a character encoding for UNIX and other archives\n"; |
|
178 |
++#endif /* !UNIX */ |
|
179 |
+ #ifdef MORE |
|
180 |
+ static ZCONST char Far ZipInfoUsageLine4[] = |
|
181 |
+ " -M page output through built-in \"more\"\n"; |
|
182 |
+@@ -664,6 +674,17 @@ |
|
183 |
+ -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields\n\ |
|
184 |
+ -C match filenames case-insensitively -L make (some) names \ |
|
185 |
+ lowercase\n %-42s -V retain VMS version numbers\n%s"; |
|
186 |
++#elif (defined UNIX) |
|
187 |
++static ZCONST char Far UnzipUsageLine4[] = "\ |
|
188 |
++modifiers:\n\ |
|
189 |
++ -n never overwrite existing files -q quiet mode (-qq => quieter)\n\ |
|
190 |
++ -o overwrite files WITHOUT prompting -a auto-convert any text files\n\ |
|
191 |
++ -j junk paths (do not make directories) -aa treat ALL files as text\n\ |
|
192 |
++ -U use escapes for all non-ASCII Unicode -UU ignore any Unicode fields\n\ |
|
193 |
++ -C match filenames case-insensitively -L make (some) names \ |
|
194 |
++lowercase\n %-42s -V retain VMS version numbers\n%s\ |
|
195 |
++ -O CHARSET specify a character encoding for DOS, Windows and OS/2 archives\n\ |
|
196 |
++ -I CHARSET specify a character encoding for UNIX and other archives\n\n"; |
|
197 |
+ #else /* !VMS */ |
|
198 |
+ static ZCONST char Far UnzipUsageLine4[] = "\ |
|
199 |
+ modifiers:\n\ |
|
200 |
+@@ -802,6 +823,10 @@ |
|
201 |
+ #endif /* UNICODE_SUPPORT */ |
|
202 |
+ |
|
203 |
+ |
|
204 |
++#ifdef UNIX |
|
205 |
++ init_conversion_charsets(); |
|
206 |
++#endif |
|
207 |
++ |
|
208 |
+ #if (defined(__IBMC__) && defined(__DEBUG_ALLOC__)) |
|
209 |
+ extern void DebugMalloc(void); |
|
210 |
+ |
|
211 |
+@@ -1335,6 +1360,11 @@ |
|
212 |
+ argc = *pargc; |
|
213 |
+ argv = *pargv; |
|
214 |
+ |
|
215 |
++#ifdef UNIX |
|
216 |
++ extern char OEM_CP[MAX_CP_NAME]; |
|
217 |
++ extern char ISO_CP[MAX_CP_NAME]; |
|
218 |
++#endif |
|
219 |
++ |
|
220 |
+ while (++argv, (--argc > 0 && *argv != NULL && **argv == '-')) { |
|
221 |
+ s = *argv + 1; |
|
222 |
+ while ((c = *s++) != 0) { /* "!= 0": prevent Turbo C warning */ |
|
223 |
+@@ -1516,6 +1546,35 @@ |
|
224 |
+ } |
|
225 |
+ break; |
|
226 |
+ #endif /* MACOS */ |
|
227 |
++#ifdef UNIX |
|
228 |
++ case ('I'): |
|
229 |
++ if (negative) { |
|
230 |
++ Info(slide, 0x401, ((char *)slide, |
|
231 |
++ "error: encodings can't be negated")); |
|
232 |
++ return(PK_PARAM); |
|
233 |
++ } else { |
|
234 |
++ if(*s) { /* Handle the -Icharset case */ |
|
235 |
++ /* Assume that charsets can't start with a dash to spot arguments misuse */ |
|
236 |
++ if(*s == '-') { |
|
237 |
++ Info(slide, 0x401, ((char *)slide, |
|
238 |
++ "error: a valid character encoding should follow the -I argument")); |
|
239 |
++ return(PK_PARAM); |
|
240 |
++ } |
|
241 |
++ strncpy(ISO_CP, s, sizeof(ISO_CP)); |
|
242 |
++ } else { /* -I charset */ |
|
243 |
++ ++argv; |
|
244 |
++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { |
|
245 |
++ Info(slide, 0x401, ((char *)slide, |
|
246 |
++ "error: a valid character encoding should follow the -I argument")); |
|
247 |
++ return(PK_PARAM); |
|
248 |
++ } |
|
249 |
++ s = *argv; |
|
250 |
++ strncpy(ISO_CP, s, sizeof(ISO_CP)); |
|
251 |
++ } |
|
252 |
++ while(*(++s)); /* No params straight after charset name */ |
|
253 |
++ } |
|
254 |
++ break; |
|
255 |
++#endif /* ?UNIX */ |
|
256 |
+ case ('j'): /* junk pathnames/directory structure */ |
|
257 |
+ if (negative) |
|
258 |
+ uO.jflag = FALSE, negative = 0; |
|
259 |
+@@ -1591,6 +1650,35 @@ |
|
260 |
+ } else |
|
261 |
+ ++uO.overwrite_all; |
|
262 |
+ break; |
|
263 |
++#ifdef UNIX |
|
264 |
++ case ('O'): |
|
265 |
++ if (negative) { |
|
266 |
++ Info(slide, 0x401, ((char *)slide, |
|
267 |
++ "error: encodings can't be negated")); |
|
268 |
++ return(PK_PARAM); |
|
269 |
++ } else { |
|
270 |
++ if(*s) { /* Handle the -Ocharset case */ |
|
271 |
++ /* Assume that charsets can't start with a dash to spot arguments misuse */ |
|
272 |
++ if(*s == '-') { |
|
273 |
++ Info(slide, 0x401, ((char *)slide, |
|
274 |
++ "error: a valid character encoding should follow the -I argument")); |
|
275 |
++ return(PK_PARAM); |
|
276 |
++ } |
|
277 |
++ strncpy(OEM_CP, s, sizeof(OEM_CP)); |
|
278 |
++ } else { /* -O charset */ |
|
279 |
++ ++argv; |
|
280 |
++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { |
|
281 |
++ Info(slide, 0x401, ((char *)slide, |
|
282 |
++ "error: a valid character encoding should follow the -O argument")); |
|
283 |
++ return(PK_PARAM); |
|
284 |
++ } |
|
285 |
++ s = *argv; |
|
286 |
++ strncpy(OEM_CP, s, sizeof(OEM_CP)); |
|
287 |
++ } |
|
288 |
++ while(*(++s)); /* No params straight after charset name */ |
|
289 |
++ } |
|
290 |
++ break; |
|
291 |
++#endif /* ?UNIX */ |
|
292 |
+ case ('p'): /* pipes: extract to stdout, no messages */ |
|
293 |
+ if (negative) { |
|
294 |
+ uO.cflag = FALSE; |
|
295 |
+Index: unzip-6.0/unzpriv.h |
|
296 |
+=================================================================== |
|
297 |
+--- unzip-6.0.orig/unzpriv.h 2015-02-11 08:46:43.675324290 -0500 |
|
298 |
+@@ -3008,7 +3008,7 @@ |
|
299 |
+ !(((islochdr) || (isuxatt)) && \ |
|
300 |
+ ((hostver) == 25 || (hostver) == 26 || (hostver) == 40))) || \ |
|
301 |
+ (hostnum) == FS_HPFS_ || \ |
|
302 |
+- ((hostnum) == FS_NTFS_ && (hostver) == 50)) { \ |
|
303 |
++ ((hostnum) == FS_NTFS_ /* && (hostver) == 50 */ )) { \ |
|
304 |
+ _OEM_INTERN((string)); \ |
|
305 |
+ } else { \ |
|
306 |
+ _ISO_INTERN((string)); \ |
|
307 |
+Index: unzip-6.0/zipinfo.c |
|
308 |
+=================================================================== |
|
309 |
+--- unzip-6.0.orig/zipinfo.c 2015-02-11 08:46:43.675324290 -0500 |
|
310 |
+@@ -457,6 +457,10 @@ |
|
311 |
+ int tflag_slm=TRUE, tflag_2v=FALSE; |
|
312 |
+ int explicit_h=FALSE, explicit_t=FALSE; |
|
313 |
+ |
|
314 |
++#ifdef UNIX |
|
315 |
++ extern char OEM_CP[MAX_CP_NAME]; |
|
316 |
++ extern char ISO_CP[MAX_CP_NAME]; |
|
317 |
++#endif |
|
318 |
+ |
|
319 |
+ #ifdef MACOS |
|
320 |
+ uO.lflag = LFLAG; /* reset default on each call */ |
|
321 |
+@@ -501,6 +505,35 @@ |
|
322 |
+ uO.lflag = 0; |
|
323 |
+ } |
|
324 |
+ break; |
|
325 |
++#ifdef UNIX |
|
326 |
++ case ('I'): |
|
327 |
++ if (negative) { |
|
328 |
++ Info(slide, 0x401, ((char *)slide, |
|
329 |
++ "error: encodings can't be negated")); |
|
330 |
++ return(PK_PARAM); |
|
331 |
++ } else { |
|
332 |
++ if(*s) { /* Handle the -Icharset case */ |
|
333 |
++ /* Assume that charsets can't start with a dash to spot arguments misuse */ |
|
334 |
++ if(*s == '-') { |
|
335 |
++ Info(slide, 0x401, ((char *)slide, |
|
336 |
++ "error: a valid character encoding should follow the -I argument")); |
|
337 |
++ return(PK_PARAM); |
|
338 |
++ } |
|
339 |
++ strncpy(ISO_CP, s, sizeof(ISO_CP)); |
|
340 |
++ } else { /* -I charset */ |
|
341 |
++ ++argv; |
|
342 |
++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { |
|
343 |
++ Info(slide, 0x401, ((char *)slide, |
|
344 |
++ "error: a valid character encoding should follow the -I argument")); |
|
345 |
++ return(PK_PARAM); |
|
346 |
++ } |
|
347 |
++ s = *argv; |
|
348 |
++ strncpy(ISO_CP, s, sizeof(ISO_CP)); |
|
349 |
++ } |
|
350 |
++ while(*(++s)); /* No params straight after charset name */ |
|
351 |
++ } |
|
352 |
++ break; |
|
353 |
++#endif /* ?UNIX */ |
|
354 |
+ case 'l': /* longer form of "ls -l" type listing */ |
|
355 |
+ if (negative) |
|
356 |
+ uO.lflag = -2, negative = 0; |
|
357 |
+@@ -521,6 +554,35 @@ |
|
358 |
+ G.M_flag = TRUE; |
|
359 |
+ break; |
|
360 |
+ #endif |
|
361 |
++#ifdef UNIX |
|
362 |
++ case ('O'): |
|
363 |
++ if (negative) { |
|
364 |
++ Info(slide, 0x401, ((char *)slide, |
|
365 |
++ "error: encodings can't be negated")); |
|
366 |
++ return(PK_PARAM); |
|
367 |
++ } else { |
|
368 |
++ if(*s) { /* Handle the -Ocharset case */ |
|
369 |
++ /* Assume that charsets can't start with a dash to spot arguments misuse */ |
|
370 |
++ if(*s == '-') { |
|
371 |
++ Info(slide, 0x401, ((char *)slide, |
|
372 |
++ "error: a valid character encoding should follow the -I argument")); |
|
373 |
++ return(PK_PARAM); |
|
374 |
++ } |
|
375 |
++ strncpy(OEM_CP, s, sizeof(OEM_CP)); |
|
376 |
++ } else { /* -O charset */ |
|
377 |
++ ++argv; |
|
378 |
++ if(!(--argc > 0 && *argv != NULL && **argv != '-')) { |
|
379 |
++ Info(slide, 0x401, ((char *)slide, |
|
380 |
++ "error: a valid character encoding should follow the -O argument")); |
|
381 |
++ return(PK_PARAM); |
|
382 |
++ } |
|
383 |
++ s = *argv; |
|
384 |
++ strncpy(OEM_CP, s, sizeof(OEM_CP)); |
|
385 |
++ } |
|
386 |
++ while(*(++s)); /* No params straight after charset name */ |
|
387 |
++ } |
|
388 |
++ break; |
|
389 |
++#endif /* ?UNIX */ |
|
390 |
+ case 's': /* default: shorter "ls -l" type listing */ |
|
391 |
+ if (negative) |
|
392 |
+ uO.lflag = -2, negative = 0; |
... | ... |
@@ -1,16 +1,17 @@ |
1 | 1 |
Summary: Unzip-6.0 |
2 | 2 |
Name: unzip |
3 | 3 |
Version: 6.0 |
4 |
-Release: 5%{?dist} |
|
4 |
+Release: 6%{?dist} |
|
5 | 5 |
License: BSD |
6 | 6 |
URL: http://www.gnu.org/software/%{name} |
7 | 7 |
Source0: http://downloads.sourceforge.net/infozip/unzip60.tar.gz |
8 | 8 |
%define sha1 unzip=abf7de8a4018a983590ed6f5cbd990d4740f8a22 |
9 | 9 |
Group: System Environment/Utilities |
10 | 10 |
Vendor: VMware, Inc. |
11 |
-Distribution: Photon |
|
11 |
+Distribution: Photon |
|
12 | 12 |
|
13 |
-Patch0: cve-2014-9636.patch |
|
13 |
+Patch0: cve-2014-9636.patch |
|
14 |
+Patch1: cve-2015-1315.patch |
|
14 | 15 |
|
15 | 16 |
%description |
16 | 17 |
The UnZip package contains ZIP extraction utilities. These are useful |
... | ... |
@@ -20,6 +21,7 @@ with PKZIP or Info-ZIP utilities, primarily in a DOS environment. |
20 | 20 |
%prep |
21 | 21 |
%setup -qn unzip60 |
22 | 22 |
%patch0 -p1 |
23 |
+%patch1 -p1 |
|
23 | 24 |
|
24 | 25 |
%build |
25 | 26 |
case `uname -m` in |
... | ... |
@@ -50,6 +52,8 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck} |
50 | 50 |
%{_bindir}/* |
51 | 51 |
|
52 | 52 |
%changelog |
53 |
+* Tue Sep 20 2016 Kumar Kaushik <kaushikk@vmware.com> 6.0-6 |
|
54 |
+- Added patch for CVE-2015-1315 |
|
53 | 55 |
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.0-5 |
54 | 56 |
- GA - Bump release of all rpms |
55 | 57 |
* Tue May 10 2016 Nick Shi <nshi@vmware.com> 6.0-4 |