diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/common/unzip.c | 9 | ||||
-rw-r--r-- | src/include/extractor.h | 2 | ||||
-rw-r--r-- | src/plugins/zip_extractor.c | 22 |
4 files changed, 22 insertions, 15 deletions
@@ -1,3 +1,7 @@ | |||
1 | Sun Aug 5 22:37:28 CEST 2018 | ||
2 | Fix missing 0-terminator on corrupted ZIP files | ||
3 | reported by AdLab of Venustech (#5405). -CG | ||
4 | |||
1 | Thu Jul 12 22:26:36 CEST 2018 | 5 | Thu Jul 12 22:26:36 CEST 2018 |
2 | Fix potential infinite loop in mpeg extractor. | 6 | Fix potential infinite loop in mpeg extractor. |
3 | Fix build issue with FFmpeg 4.0 (Debian #888373). | 7 | Fix build issue with FFmpeg 4.0 (Debian #888373). |
diff --git a/src/common/unzip.c b/src/common/unzip.c index a13f129..46683f0 100644 --- a/src/common/unzip.c +++ b/src/common/unzip.c | |||
@@ -534,11 +534,11 @@ dos_date_to_tmu_date (uLong ulDosDate, | |||
534 | * @param pfile_info file information to initialize | 534 | * @param pfile_info file information to initialize |
535 | * @param pfile_info_internal internal file information to initialize | 535 | * @param pfile_info_internal internal file information to initialize |
536 | * @param szFileName where to write the name of the current file | 536 | * @param szFileName where to write the name of the current file |
537 | * @param fileNameBufferSize number of bytes available in szFileName | 537 | * @param fileNameBufferSize number of bytes available in @a szFileName |
538 | * @param extraField where to write extra data | 538 | * @param extraField where to write extra data |
539 | * @param extraFieldBufferSize number of bytes available in extraField | 539 | * @param extraFieldBufferSize number of bytes available in extraField |
540 | * @param szComment where to write the comment on the current file | 540 | * @param szComment where to write the comment on the current file |
541 | * @param commentBufferSize number of bytes available in szComment | 541 | * @param commentBufferSize number of bytes available in @a szComment |
542 | * @return #EXTRACTOR_UNZIP_OK if there is no problem. | 542 | * @return #EXTRACTOR_UNZIP_OK if there is no problem. |
543 | */ | 543 | */ |
544 | static int | 544 | static int |
@@ -664,7 +664,10 @@ get_current_file_info (struct EXTRACTOR_UnzipFile *file, | |||
664 | uSizeRead = file_info.size_file_comment; | 664 | uSizeRead = file_info.size_file_comment; |
665 | } | 665 | } |
666 | else | 666 | else |
667 | uSizeRead = commentBufferSize; | 667 | { |
668 | *(szComment+commentBufferSize - 1) = '\0'; | ||
669 | uSizeRead = commentBufferSize - 1; | ||
670 | } | ||
668 | 671 | ||
669 | if (0 != lSeek) | 672 | if (0 != lSeek) |
670 | { | 673 | { |
diff --git a/src/include/extractor.h b/src/include/extractor.h index cb58aff..18a6c38 100644 --- a/src/include/extractor.h +++ b/src/include/extractor.h | |||
@@ -35,7 +35,7 @@ extern "C" { | |||
35 | * 0.2.6-1 => 0x00020601 | 35 | * 0.2.6-1 => 0x00020601 |
36 | * 4.5.2-0 => 0x04050200 | 36 | * 4.5.2-0 => 0x04050200 |
37 | */ | 37 | */ |
38 | #define EXTRACTOR_VERSION 0x01070000 | 38 | #define EXTRACTOR_VERSION 0x01070001 |
39 | 39 | ||
40 | #include <stdio.h> | 40 | #include <stdio.h> |
41 | 41 | ||
diff --git a/src/plugins/zip_extractor.c b/src/plugins/zip_extractor.c index ca60b64..717d76d 100644 --- a/src/plugins/zip_extractor.c +++ b/src/plugins/zip_extractor.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * it under the terms of the GNU General Public License as published | 6 | * it under the terms of the GNU General Public License as published |
7 | * by the Free Software Foundation; either version 3, or (at your | 7 | * by the Free Software Foundation; either version 3, or (at your |
8 | * option) any later version. | 8 | * option) any later version. |
9 | * | 9 | * |
10 | * libextractor is distributed in the hope that it will be useful, but | 10 | * libextractor is distributed in the hope that it will be useful, but |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
@@ -16,7 +16,7 @@ | |||
16 | * along with libextractor; see the file COPYING. If not, write to the | 16 | * along with libextractor; see the file COPYING. If not, write to the |
17 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | * Boston, MA 02110-1301, USA. | 18 | * Boston, MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file plugins/zip_extractor.c | 21 | * @file plugins/zip_extractor.c |
22 | * @brief plugin to support ZIP files | 22 | * @brief plugin to support ZIP files |
@@ -27,9 +27,9 @@ | |||
27 | #include "extractor.h" | 27 | #include "extractor.h" |
28 | #include "unzip.h" | 28 | #include "unzip.h" |
29 | 29 | ||
30 | 30 | ||
31 | /** | 31 | /** |
32 | * Main entry method for the 'application/zip' extraction plugin. | 32 | * Main entry method for the 'application/zip' extraction plugin. |
33 | * | 33 | * |
34 | * @param ec extraction context provided to the plugin | 34 | * @param ec extraction context provided to the plugin |
35 | */ | 35 | */ |
@@ -57,12 +57,12 @@ EXTRACTOR_zip_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
57 | } | 57 | } |
58 | if (EXTRACTOR_UNZIP_OK != | 58 | if (EXTRACTOR_UNZIP_OK != |
59 | EXTRACTOR_common_unzip_go_to_first_file (uf)) | 59 | EXTRACTOR_common_unzip_go_to_first_file (uf)) |
60 | { | 60 | { |
61 | /* zip malformed? */ | 61 | /* zip malformed? */ |
62 | goto CLEANUP; | 62 | goto CLEANUP; |
63 | } | 63 | } |
64 | if (0 != | 64 | if (0 != |
65 | ec->proc (ec->cls, | 65 | ec->proc (ec->cls, |
66 | "zip", | 66 | "zip", |
67 | EXTRACTOR_METATYPE_MIMETYPE, | 67 | EXTRACTOR_METATYPE_MIMETYPE, |
68 | EXTRACTOR_METAFORMAT_UTF8, | 68 | EXTRACTOR_METAFORMAT_UTF8, |
@@ -77,7 +77,7 @@ EXTRACTOR_zip_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
77 | { | 77 | { |
78 | if ( (0 != strlen (fcomment)) && | 78 | if ( (0 != strlen (fcomment)) && |
79 | (0 != | 79 | (0 != |
80 | ec->proc (ec->cls, | 80 | ec->proc (ec->cls, |
81 | "zip", | 81 | "zip", |
82 | EXTRACTOR_METATYPE_COMMENT, | 82 | EXTRACTOR_METATYPE_COMMENT, |
83 | EXTRACTOR_METAFORMAT_C_STRING, | 83 | EXTRACTOR_METAFORMAT_C_STRING, |
@@ -99,7 +99,7 @@ EXTRACTOR_zip_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
99 | { | 99 | { |
100 | if ( (0 != strlen (fname)) && | 100 | if ( (0 != strlen (fname)) && |
101 | (0 != | 101 | (0 != |
102 | ec->proc (ec->cls, | 102 | ec->proc (ec->cls, |
103 | "zip", | 103 | "zip", |
104 | EXTRACTOR_METATYPE_FILENAME, | 104 | EXTRACTOR_METATYPE_FILENAME, |
105 | EXTRACTOR_METAFORMAT_C_STRING, | 105 | EXTRACTOR_METAFORMAT_C_STRING, |
@@ -109,7 +109,7 @@ EXTRACTOR_zip_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
109 | goto CLEANUP; | 109 | goto CLEANUP; |
110 | if ( (0 != strlen (fcomment)) && | 110 | if ( (0 != strlen (fcomment)) && |
111 | (0 != | 111 | (0 != |
112 | ec->proc (ec->cls, | 112 | ec->proc (ec->cls, |
113 | "zip", | 113 | "zip", |
114 | EXTRACTOR_METATYPE_COMMENT, | 114 | EXTRACTOR_METATYPE_COMMENT, |
115 | EXTRACTOR_METAFORMAT_C_STRING, | 115 | EXTRACTOR_METAFORMAT_C_STRING, |
@@ -117,11 +117,11 @@ EXTRACTOR_zip_extract_method (struct EXTRACTOR_ExtractContext *ec) | |||
117 | fcomment, | 117 | fcomment, |
118 | strlen (fcomment) + 1))) | 118 | strlen (fcomment) + 1))) |
119 | goto CLEANUP; | 119 | goto CLEANUP; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | while (EXTRACTOR_UNZIP_OK == | 122 | while (EXTRACTOR_UNZIP_OK == |
123 | EXTRACTOR_common_unzip_go_to_next_file (uf)); | 123 | EXTRACTOR_common_unzip_go_to_next_file (uf)); |
124 | 124 | ||
125 | CLEANUP: | 125 | CLEANUP: |
126 | (void) EXTRACTOR_common_unzip_close (uf); | 126 | (void) EXTRACTOR_common_unzip_close (uf); |
127 | } | 127 | } |