diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2014-12-04 22:25:39 +0100 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2014-12-04 22:05:40 +0000 |
commit | 73f48a0916c64739e39c27203883ccb13b33aabc (patch) | |
tree | 681b71cf59b9976290d4b91ecd3b2ef6849804ca /epan/dissectors/packet-i2c.c | |
parent | 70ca52c0233036c5648a164f8dbc444bf911ed18 (diff) |
dont't manually throw a ReportedBoundsError if the packet is empty
use tvb_captured_length() instead of tvb_length()
Change-Id: I7e7efd69515fc3e30c986ac5d9a56b4db1931c10
Reviewed-on: https://code.wireshark.org/review/5624
Reviewed-by: Martin Kaiser <wireshark@kaiser.cx>
Tested-by: Martin Kaiser <wireshark@kaiser.cx>
Diffstat (limited to 'epan/dissectors/packet-i2c.c')
-rw-r--r-- | epan/dissectors/packet-i2c.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/epan/dissectors/packet-i2c.c b/epan/dissectors/packet-i2c.c index 1f483a2a52..9c920f5e61 100644 --- a/epan/dissectors/packet-i2c.c +++ b/epan/dissectors/packet-i2c.c @@ -27,7 +27,6 @@ #include <glib.h> #include <epan/packet.h> -#include <epan/exceptions.h> #include <epan/prefs.h> #include <wiretap/wtap.h> @@ -189,18 +188,14 @@ dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_item *ti; proto_tree *i2c_tree = NULL; - int is_event, bus, flags, addr, len; + int is_event, bus, flags, addr; is_event = pinfo->pseudo_header->i2c.is_event; flags = pinfo->pseudo_header->i2c.flags; bus = pinfo->pseudo_header->i2c.bus; - len = tvb_length(tvb); if (is_event) { addr = 0; } else { - if (len == 0) { - THROW(ReportedBoundsError); - } /* Report 7-bit hardware address */ addr = tvb_get_guint8(tvb, 0) >> 1; } @@ -225,7 +220,7 @@ dissect_i2c(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) i2c_get_event_desc(flags)); else col_add_fstr(pinfo->cinfo, COL_INFO, "I2C %s, %d bytes", - (flags & I2C_FLAG_RD) ? "Read" : "Write", len); + (flags & I2C_FLAG_RD) ? "Read" : "Write", tvb_captured_length(tvb)); if (tree) { ti = proto_tree_add_protocol_format(tree, proto_i2c, tvb, 0, -1, |