diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-05-13 21:18:26 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-05-13 21:18:26 +0000 |
commit | c845015f0645b6da7e5d7dc8f02002f3713651d0 (patch) | |
tree | 085dcc250e18aa4a38218fde65029f263ad216bd /packet-q931.c | |
parent | a92af3868dc04904daf6148b1b8368bdbddb9572 (diff) |
Have "is_tpkt()" take a minimum-payload-length argument and check
whether the length value in the TPKT header is large enough to include
that much payload - if not, report the packet as not being a TPKT
packet.
Have the heuristic Q.931 dissector supply the appropriate value.
svn path=/trunk/; revision=5457
Diffstat (limited to 'packet-q931.c')
-rw-r--r-- | packet-q931.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/packet-q931.c b/packet-q931.c index d793e0b859..c14329a7f0 100644 --- a/packet-q931.c +++ b/packet-q931.c @@ -2,7 +2,7 @@ * Routines for Q.931 frame disassembly * Guy Harris <guy@alum.mit.edu> * - * $Id: packet-q931.c,v 1.42 2002/03/25 20:23:17 guy Exp $ + * $Id: packet-q931.c,v 1.43 2002/05/13 21:18:25 guy Exp $ * * Modified by Andreas Sikkema for possible use with H.323 * @@ -2503,8 +2503,13 @@ dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Check whether this looks like a TPKT-encapsulated * Q.931 packet. + * + * The minimum length of a Q.931 message is 3: + * 1 byte for the protocol discriminator, + * 1 for the call_reference length, + * and one for the message type. */ - lv_tpkt_len = is_tpkt(tvb); + lv_tpkt_len = is_tpkt(tvb, 3); if (lv_tpkt_len == -1) { /* * It's not a TPKT packet; reject it. @@ -2533,24 +2538,17 @@ dissect_q931_tpkt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * check whether it looks like the beginning of a * Q.931 message. * - * The minimum length of a Q.931 message is 3: - * 1 byte for the protocol discriminator, - * 1 for the call_reference length, - * and one for the message type. + * The minimum length of a Q.931 message is 3, as per the + * above. * - * Check that we have that many bytes past the - * TPKT header. + * Check that we have that many bytes past the TPKT header in + * the tvbuff; we already know that the TPKT header says we + * have that many bytes (as we passed 3 as the "min_len" argument + * to "is_tpkt()"). */ if (!tvb_bytes_exist(tvb, 4, 3)) return FALSE; - /* - * And check that we have that many bytes in the TPKT - * packet. - */ - if (lv_tpkt_len < 3) - return FALSE; - /* Check the protocol discriminator */ if (tvb_get_guint8(tvb, 4) != NLPID_Q_931) { /* Doesn't look like Q.931 inside TPKT */ |