summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPascal Quantin <pascal.quantin@gmail.com>2013-10-10 08:15:55 +0000
committerPascal Quantin <pascal.quantin@gmail.com>2013-10-10 08:15:55 +0000
commita77e3754c90e9d6e04b9a61a4bcf830a2efab57b (patch)
tree0e0d41c7a44f959f244de3fc565d5c27e9a0176a
parentee0fc35c096ca40ff0fa20d7928673c03ad310bd (diff)
downloadwireshark-a77e3754c90e9d6e04b9a61a4bcf830a2efab57b.tar.gz
Slightly change heuristics
svn path=/trunk/; revision=52487
-rw-r--r--epan/dissectors/packet-mbim.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/epan/dissectors/packet-mbim.c b/epan/dissectors/packet-mbim.c
index b3e1ac22ea..88f7c23299 100644
--- a/epan/dissectors/packet-mbim.c
+++ b/epan/dissectors/packet-mbim.c
@@ -4415,17 +4415,22 @@ dissect_mbim_bulk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
proto_item *ti, *sig_ti;
proto_tree *mbim_tree, *subtree, *sig_tree;
gboolean is_32bits;
- guint32 length, next_index, base_offset, offset, datagram_index, datagram_length, nb,
- total = 0;
+ guint32 nth_sig, length, next_index, base_offset, offset, datagram_index, datagram_length,
+ nb, total = 0;
guint8 *signature;
dissector_handle_t dissector;
tvbuff_t *datagram_tvb;
- const guchar NTH16[4] = {'N', 'C', 'M', 'H'};
- const guchar NTH32[4] = {'n', 'c', 'm', 'h'};
+ const guint32 NTH16 = 0x484D434E;
+ const guint32 NTH32 = 0x686D636E;
- if (tvb_memeql(tvb, 0, NTH16, sizeof(NTH16)) == 0) {
+ if (tvb_length(tvb) < 12) {
+ return 0;
+ }
+
+ nth_sig = tvb_get_letohl(tvb, 0);
+ if (nth_sig == NTH16) {
is_32bits = FALSE;
- } else if (tvb_memeql(tvb, 0, NTH32, sizeof(NTH32)) == 0) {
+ } else if (nth_sig == NTH32) {
is_32bits = TRUE;
} else {
return 0;