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.

svn path=/trunk/; revision=24630
This commit is contained in:
Stig Bjørlykke 2008-03-14 19:03:56 +00:00
parent d63ad769ff
commit ccf85f3195
1 changed files with 4 additions and 2 deletions

View File

@ -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;