summaryrefslogtreecommitdiff
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2012-04-12 05:36:26 +0000
committerAnders Broman <anders.broman@ericsson.com>2012-04-12 05:36:26 +0000
commit5d101caa89e28875c5d2eeb2b353cbb8e2155336 (patch)
tree640caf1df163f31160481eb06a0be854912647bf /epan/tvbuff.c
parent8cdb90bd44c3dcc0386100974c56e5595315edac (diff)
downloadwireshark-5d101caa89e28875c5d2eeb2b353cbb8e2155336.tar.gz
From Martin Kaiser: CID 525 is about tvb_new_octet_aligned(). datalen can be negative or 0 when ep_alloc0(datalen) is called. If this happens, it's because of a dissector not checking the bit_offset, I think a DISSECTOR_ASSERT() is ok for fixing this. https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7068
svn path=/trunk/; revision=42032
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index 1aa0b84147..c6b9d694ce 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -319,6 +319,7 @@ tvb_new_octet_aligned(tvbuff_t *tvb, guint32 bit_offset, gint32 no_of_bits)
return tvb_new_subset(tvb, byte_offset, datalen, -1);
}
+ DISSECTOR_ASSERT(datalen>0);
buf = ep_alloc0(datalen);
/* if at least one trailing byte is available, we must use the content