aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2021-06-28 12:04:05 +0200
committerWireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2021-07-01 10:20:48 +0000
commitc0e70f67b3a967cd550446e95a5c52df28e8ddbe (patch)
tree96f8d9007a6703189030d3ba3692aaff929992ee /epan/tvbuff.c
parentb4a54704979f4cc3aa004d79185ba8cc63c1c5cd (diff)
tvbuff: add a DISSECTOR_ASSERT to tvb_bytes_to_str.
It has been added since its length is signed, while the underlying bytes_to_str uses a size_t, causing an unwanted cast. Basically passing a len < 0 is pointless.
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 1caaa3cae0..d3a0e0d713 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -4329,6 +4329,7 @@ tvb_bcd_dig_to_wmem_packet_str_be(tvbuff_t *tvb, const gint offset, const gint l
gchar *tvb_bytes_to_str(wmem_allocator_t *allocator, tvbuff_t *tvb,
const gint offset, const gint len)
{
+ DISSECTOR_ASSERT(len > 0);
return bytes_to_str(allocator, ensure_contiguous(tvb, offset, len), len);
}