summaryrefslogtreecommitdiff
path: root/epan/tvbuff.c
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-12 17:53:51 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2013-07-12 17:53:51 +0000
commitd2b93398f9fb725740e849f8337f6defb886d02c (patch)
tree96cc40360734b2eff21fb6e18193bd92373283ae /epan/tvbuff.c
parentcab1f9fc0cdbb9aee40f431cd2735f29dd146925 (diff)
downloadwireshark-d2b93398f9fb725740e849f8337f6defb886d02c.tar.gz
fix subset tvb: we want to do operation on backing tvb on position: abs_offset + subset_offset, abs_offset - subset_offset makes no sense.
Right now it doesn't really matter, cause tvb subsets always have real_data. Without fix, and with small modification in ensure_contigous_no_expcetion() to first check for ->tvb_get_ptr() and later real_data epan doesn't work and it flood console with warnings like: ** (process): WARNING **: Dissector bug, protocol IPv4, in packet 3823: tvbuff.c:976: failed assertion "exception > 0" svn path=/trunk/; revision=50537
Diffstat (limited to 'epan/tvbuff.c')
-rw-r--r--epan/tvbuff.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/tvbuff.c b/epan/tvbuff.c
index a29a92e6db..5ee2ce6fdc 100644
--- a/epan/tvbuff.c
+++ b/epan/tvbuff.c
@@ -962,7 +962,7 @@ subset_get_ptr(tvbuff_t *tvb, guint abs_offset, guint abs_length)
{
struct tvb_subset *subset_tvb = (struct tvb_subset *) tvb;
- return ensure_contiguous_no_exception(subset_tvb->subset.tvb, abs_offset - subset_tvb->subset.offset, abs_length, NULL);
+ return ensure_contiguous_no_exception(subset_tvb->subset.tvb, subset_tvb->subset.offset + abs_offset, abs_length, NULL);
}
static const guint8*
@@ -1107,7 +1107,7 @@ subset_memcpy(tvbuff_t *tvb, void *target, guint abs_offset, guint abs_length)
{
struct tvb_subset *subset_tvb = (struct tvb_subset *) tvb;
- return tvb_memcpy(subset_tvb->subset.tvb, target, abs_offset - subset_tvb->subset.offset, abs_length);
+ return tvb_memcpy(subset_tvb->subset.tvb, target, subset_tvb->subset.offset + abs_offset, abs_length);
}
void *
@@ -1960,7 +1960,7 @@ subset_find_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, guint8 needle)
{
struct tvb_subset *subset_tvb = (struct tvb_subset *) tvb;
- return tvb_find_guint8(subset_tvb->subset.tvb, abs_offset - subset_tvb->subset.offset, limit, needle);
+ return tvb_find_guint8(subset_tvb->subset.tvb, subset_tvb->subset.offset + abs_offset, limit, needle);
}
/* Find first occurrence of any of the needles in tvbuff, starting at offset.
@@ -2023,7 +2023,7 @@ subset_pbrk_guint8(tvbuff_t *tvb, guint abs_offset, guint limit, const guint8 *n
{
struct tvb_subset *subset_tvb = (struct tvb_subset *) tvb;
- return tvb_pbrk_guint8(subset_tvb->subset.tvb, abs_offset - subset_tvb->subset.offset, limit, needles, found_needle);
+ return tvb_pbrk_guint8(subset_tvb->subset.tvb, subset_tvb->subset.offset + abs_offset, limit, needles, found_needle);
}
/* Find size of stringz (NUL-terminated string) by looking for terminating