diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-12-25 12:00:32 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-12-25 12:00:32 +0000 |
commit | b98d44d71ffa954c070253b9a7017af4cae889f2 (patch) | |
tree | 3d7fb0e2cb6774545631e1662d27f4a542281fa4 /epan/dissectors/packet-mp2t.c | |
parent | ceb69f1413cbe8ef84f5c99fa0b0574f5ff1b48b (diff) |
If there's no packet data, there's nothing to check to see whether this
is an MPEG-2 transport packet, so don't treat it as one.
svn path=/trunk/; revision=46733
Diffstat (limited to 'epan/dissectors/packet-mp2t.c')
-rw-r--r-- | epan/dissectors/packet-mp2t.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c index 6dfca95297..99ee79259c 100644 --- a/epan/dissectors/packet-mp2t.c +++ b/epan/dissectors/packet-mp2t.c @@ -1262,14 +1262,23 @@ dissect_mp2t( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ) static gboolean heur_dissect_mp2t( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ ) { + gint length; guint offset = 0; - if (tvb_length_remaining(tvb, offset) % MP2T_PACKET_SIZE) { + length = tvb_length_remaining(tvb, offset); + if (length == 0) { + /* Nothing to check for */ + return FALSE; + } + if ((length % MP2T_PACKET_SIZE) != 0) { + /* Not a multiple of the MPEG-2 transport packet size */ return FALSE; } else { - while (tvb_length_remaining(tvb, offset) > 0) { - if (tvb_get_guint8(tvb, offset) != MP2T_SYNC_BYTE) + while (tvb_offset_exists(tvb, offset)) { + if (tvb_get_guint8(tvb, offset) != MP2T_SYNC_BYTE) { + /* No sync byte at the appropriate offset */ return FALSE; + } offset += MP2T_PACKET_SIZE; } } |