aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/file_wrappers.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-01-14 13:07:17 -0800
committerGuy Harris <guy@alum.mit.edu>2018-01-14 21:08:18 +0000
commit9cc00c562369fe0b9149eb2aeee090cf52167285 (patch)
tree00f52bc3c14ae31681d6e6b931b3f942f9bcebfa /wiretap/file_wrappers.c
parentc3190d9d70febdd1dbc15269e970f32aeda33f76 (diff)
Check for gzipped files even if we don't have libz.
If we aren't built with libz, report a new "decompression not supported" error if the file is gzipped; the problem isn't that it's a new capture file format we don't support, it's that a *compressed* capture file, in some format, but we don't support the *compression* format used. This can be extended if we add support for other compression formats. Change-Id: I19239525d4e02357e3ca7189996556839af8fce2 Reviewed-on: https://code.wireshark.org/review/25315 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap/file_wrappers.c')
-rw-r--r--wiretap/file_wrappers.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 56cd2711c8..8d5ff51b51 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -574,13 +574,13 @@ gz_head(FILE_T state)
}
/* look for the gzip magic header bytes 31 and 139 */
-#ifdef HAVE_ZLIB
if (state->next_in[0] == 31) {
state->avail_in--;
state->next_in++;
if (state->avail_in == 0 && fill_in_buffer(state) == -1)
return -1;
if (state->avail_in && state->next_in[0] == 139) {
+#ifdef HAVE_ZLIB
guint8 cm;
guint8 flags;
guint16 len;
@@ -662,8 +662,13 @@ gz_head(FILE_T state)
state->fast_seek_cur = cur;
fast_seek_header(state, state->raw_pos - state->avail_in, state->pos, GZIP_AFTER_HEADER);
}
-#endif
+#endif /* Z_BLOCK */
return 0;
+#else /* HAVE_ZLIB */
+ state->err = WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED;
+ state->err_info = "reading gzip-compressed files isn't supported";
+ return -1;
+#endif /* HAVE_ZLIB */
}
else {
/* not a gzip file -- save first byte (31) and fall to raw i/o */
@@ -671,7 +676,6 @@ gz_head(FILE_T state)
state->have = 1;
}
}
-#endif
#ifdef HAVE_LIBXZ
/* { 0xFD, '7', 'z', 'X', 'Z', 0x00 } */
/* FD 37 7A 58 5A 00 */