diff options
author | Pascal Quantin <pascal.quantin@gmail.com> | 2016-10-12 17:40:12 +0200 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2016-10-12 17:27:37 +0000 |
commit | 0674a92cffa2a68d866aa453673a9fbbd723fed6 (patch) | |
tree | c4290bd149f204acccd1e50b02d22cf025bba780 /epan/dissectors/packet-raknet.c | |
parent | 6ae3ba02f7156bf5e7eb5e189f287fcb5027f0ff (diff) |
RakNet: fix heuristic dissector
RAKNET_OFFLINE_MESSAGE_DATA_ID starts with 0x0, which means NULL
character. this give a string of length 0 and RakNet heuristic was
wrongly catching all UDP packets.
Let's do a memcmp instead of a strncmp.
Change-Id: I38e98838b114037bf37a218003bade88261a2dd8
Reviewed-on: https://code.wireshark.org/review/18167
Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-raknet.c')
-rw-r--r-- | epan/dissectors/packet-raknet.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/epan/dissectors/packet-raknet.c b/epan/dissectors/packet-raknet.c index d075329ffd..82e58e3bbb 100644 --- a/epan/dissectors/packet-raknet.c +++ b/epan/dissectors/packet-raknet.c @@ -41,7 +41,7 @@ /* * RakNet Protocol Constants. */ -#define RAKNET_OFFLINE_MESSAGE_DATA_ID "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78" +guint8 RAKNET_OFFLINE_MESSAGE_DATA_ID[16] = {0x00, 0xff, 0xff, 0x00, 0xfe, 0xfe, 0xfe, 0xfe, 0xfd, 0xfd, 0xfd, 0xfd, 0x12, 0x34, 0x56, 0x78}; #define RAKNET_CHALLENGE_LENGTH 64 #define RAKNET_ANSWER_LENGTH 128 #define RAKNET_PROOF_LENGTH 32 @@ -1540,15 +1540,15 @@ dissect_raknet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data) static gboolean test_raknet_heur(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void* data _U_) { - if (tvb_strneql(tvb, 1 + 8, RAKNET_OFFLINE_MESSAGE_DATA_ID, strlen(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { + if (tvb_memeql(tvb, 1 + 8, RAKNET_OFFLINE_MESSAGE_DATA_ID, sizeof(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { /* ID_UNCONNECTED_PING */ return TRUE; } - else if (tvb_strneql(tvb, 1, RAKNET_OFFLINE_MESSAGE_DATA_ID, strlen(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { + else if (tvb_memeql(tvb, 1, RAKNET_OFFLINE_MESSAGE_DATA_ID, sizeof(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { /* ID_OPEN_CONNECTION_REQUEST_1 */ return TRUE; } - else if (tvb_strneql(tvb, 1 + 8 + 8, RAKNET_OFFLINE_MESSAGE_DATA_ID, strlen(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { + else if (tvb_memeql(tvb, 1 + 8 + 8, RAKNET_OFFLINE_MESSAGE_DATA_ID, sizeof(RAKNET_OFFLINE_MESSAGE_DATA_ID)) == 0) { /* ID_UNCONNECTED_PONG */ return TRUE; } |