aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-xcsl.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-03-14 19:03:56 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-03-14 19:03:56 +0000
commitc657108b22dd509a8d79997b4d3ca92ac098653a (patch)
tree12fc641d42689a7b421fabd68136b17e492d1ccc /epan/dissectors/packet-xcsl.c
parentbb0f488a0d7eaeafe38dff85a24a5874af810168 (diff)
Added check for length in heuristic check so we don't dissect unknown
TCP packets with less than 5 bytes data as a malformed XCSL packet. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24630 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-xcsl.c')
-rw-r--r--epan/dissectors/packet-xcsl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/dissectors/packet-xcsl.c b/epan/dissectors/packet-xcsl.c
index 9c1b8ce94a..35a7294cce 100644
--- a/epan/dissectors/packet-xcsl.c
+++ b/epan/dissectors/packet-xcsl.c
@@ -280,14 +280,16 @@ static gboolean dissect_xcsl_tcp_heur(tvbuff_t *tvb, packet_info *pinfo, proto_t
gint offset = 0;
guint8 *protocol;
- protocol = tvb_get_ephemeral_string(tvb, offset, 5);
+ if (tvb_length_remaining (tvb, offset) >= 5) {
+ protocol = tvb_get_ephemeral_string(tvb, offset, 5);
- if (strncmp(protocol,"xcsl",4) == 0 && (protocol[4] == ';' || protocol[4] == '-')) {
+ if (strncmp(protocol,"xcsl",4) == 0 && (protocol[4] == ';' || protocol[4] == '-')) {
/* Disssect it as being an xcsl message */
dissect_xcsl_tcp(tvb, pinfo, tree);
return TRUE;
+ }
}
return FALSE;