aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-03-31 12:33:10 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-03-31 12:33:10 +0000
commit60f47ed05b904eabfe07cddd38e8ab52714146c5 (patch)
tree2e456fd43b5e73600ee1da7bcba0db9e847f913c /epan/tvbuff.c
parent653a1bb918ca5c6ecfeadb1bd27a4b46b13d4d47 (diff)
Fix for bug #6480 (https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6480)
Yay, first commit since r37883 (almost 9months). svn path=/trunk/; revision=41869
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);