aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2022-01-18 11:43:08 +0100
committerA Wireshark GitLab Utility <gerald+gitlab-utility@wireshark.org>2022-01-19 13:22:01 +0000
commitf7b6ebcc042f114a4b89aae3df9955d380d2133a (patch)
treed19dcdc5c6f44a8db827ee9a1d0569f809d8bee1 /epan/tvbuff.c
parentc6de71552aa322d96386ba86affc5599bdfc6503 (diff)
tvbuff: assert the called len is > 0.
This assert will notify the higher layers that the dissector needs to be fixed. ieee1722 and zbee-zcl dissectors have been updated to prevent such a call. Ref: #17882.
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 bcf8a183ca..5dab307577 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -4318,6 +4318,7 @@ int tvb_get_token_len(tvbuff_t *tvb, const gint offset, int len, gint *next_offs
gchar *
tvb_bytes_to_str_punct(wmem_allocator_t *scope, tvbuff_t *tvb, const gint offset, const gint len, const gchar punct)
{
+ DISSECTOR_ASSERT(len > 0);
return bytes_to_str_punct(scope, ensure_contiguous(tvb, offset, len), len, punct);
}