aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 8cc9f14c0f..4cb743371d 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -3315,7 +3315,17 @@ tvb_uncompress(tvbuff_t *tvb, const int offset, int comprlen)
#endif
if (uncompr == NULL) {
- uncompr = g_memdup(strmbuf, bytes_pass);
+ /*
+ * This is ugly workaround for bug #6480
+ * (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6480)
+ *
+ * g_memdup(..., 0) returns NULL (g_malloc(0) also)
+ * when uncompr is NULL logic below doesn't create tvb
+ * which is later interpreted as decompression failed.
+ */
+ uncompr = (bytes_pass || ret != Z_STREAM_END) ?
+ g_memdup(strmbuf, bytes_pass) :
+ g_strdup("");
} else {
guint8 *new_data = g_malloc0(bytes_out + bytes_pass);