stages/*: change license to Apache 2.0
[dragora.git] / patches / unzip / unzip-6.0-valgrind.patch
blob41a752023b66eed2b82714c42bbe1841e5027347
1 diff --git a/fileio.c b/fileio.c
2 index ba0a1d0..03fc4be 100644
3 --- a/fileio.c
4 +++ b/fileio.c
5 @@ -2006,6 +2006,7 @@ int do_string(__G__ length, option) /* return PK-type error code */
6 unsigned comment_bytes_left;
7 unsigned int block_len;
8 int error=PK_OK;
9 + unsigned int length2;
10 #ifdef AMIGA
11 char tmp_fnote[2 * AMIGA_FILENOTELEN]; /* extra room for squozen chars */
12 #endif
13 @@ -2292,8 +2293,12 @@ int do_string(__G__ length, option) /* return PK-type error code */
14 seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
15 (G.inptr-G.inbuf) + length);
16 } else {
17 - if (readbuf(__G__ (char *)G.extra_field, length) == 0)
18 + if ((length2 = readbuf(__G__ (char *)G.extra_field, length)) == 0)
19 return PK_EOF;
20 + if(length2 < length) {
21 + memset (__G__ (char *)G.extra_field+length2, 0 , length-length2);
22 + length = length2;
23 + }
24 /* Looks like here is where extra fields are read */
25 getZip64Data(__G__ G.extra_field, length);
26 #ifdef UNICODE_SUPPORT