aboutsummaryrefslogtreecommitdiffstats
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2022-10-20 19:39:52 -0400
committerJohn Thacker <johnthacker@gmail.com>2022-10-21 01:11:53 +0000
commitd7c993d4afbc52306330c089fb74c6f5bebfec37 (patch)
tree041dc3154db54d78b3bac7e2d83b7b69c5dcc1c5 /epan/tvbuff.c
parent31ee273517820c29e546ae1f6c7b6b55b9d9cde9 (diff)
epan: Fix the end offsets for hex string items
hex_str_to_bytes_encoding() consumes pairs of hex digits (and optional separator) to turn into bytes. It can return a pointer to the character after the last digit consumed. Don't advance the end pointer after a single unpaired digit that is not consumed as part of the hex string returned. tvb_get_string_bytes() can pass back the end offset. If conversion fails, return the initial offset instead of zero to make repeated calls easier in cases where the full length is not decoded due to errors. Relatedly, no dissector currently uses this return value, because it's not useful currently.
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index c849e2558d..be23e3408f 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -1748,7 +1748,7 @@ tvb_get_string_bytes(tvbuff_t *tvb, const gint offset, const gint length,
ptr = (gchar*) tvb_get_raw_string(NULL, tvb, offset, length);
begin = ptr;
- if (endoff) *endoff = 0;
+ if (endoff) *endoff = offset;
while (*begin == ' ') begin++;