diff options
author | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-03-25 19:02:18 +0000 |
---|---|---|
committer | Jeff Morriss <jeff.morriss@ulticom.com> | 2011-03-25 19:02:18 +0000 |
commit | cc6fc23812104d4a075a3beac738c7dcd3ee8e8b (patch) | |
tree | 018418cf804b5694292966d5073ccffac84a3bd4 | |
parent | 28ef67fb391330d617c5d43b0179069aff725497 (diff) |
From Didier via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3055 :
Apply rev 25869 to most of the rest of the TCP-desegmenting dissectors.
(The SSL dissector was already updated in one of two spots with bug 4535/rev
32456.)
A couple of the patches had to be manually applied.
From me: Fix the comments to match the change (including in the TCP and SSL
dissectors.)
svn path=/trunk/; revision=36332
-rw-r--r-- | asn1/snmp/packet-snmp-template.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-bgp.c | 10 | ||||
-rw-r--r-- | epan/dissectors/packet-rtsp.c | 11 | ||||
-rw-r--r-- | epan/dissectors/packet-snmp.c | 16 | ||||
-rw-r--r-- | epan/dissectors/packet-ssh.c | 34 | ||||
-rw-r--r-- | epan/dissectors/packet-ssl.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-tcp.c | 6 | ||||
-rw-r--r-- | epan/dissectors/packet-tds.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-tpkt.c | 12 | ||||
-rw-r--r-- | epan/dissectors/packet-x11.c | 23 |
10 files changed, 113 insertions, 49 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index be94c9b073..03839f7660 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -1561,8 +1561,16 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, * BER). */ if (length_remaining < 6) { + /* + * Yes. Tell the TCP dissector where the data + * for this message starts in the data it handed + * us and that we need "some more data." Don't tell + * it exactly how many bytes we need because if/when + * we ask for even more (after the header) that will + * break reassembly. + */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 6 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; /* * Return 0, which means "I didn't dissect anything diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 3dafdd8bd3..edc5fd85dd 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -2912,12 +2912,14 @@ dissect_bgp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) */ if (length_remaining < BGP_HEADER_SIZE) { /* - * Yes. Tell the TCP dissector where the data for this - * message starts in the data it handed us, and how many - * more bytes we need, and return. + * Yes. Tell the TCP dissector where the data for this message + * starts in the data it handed us and that we need "some more + * data." Don't tell it exactly how many bytes we need because + * if/when we ask for even more (after the header) that will + * break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = BGP_HEADER_SIZE - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } diff --git a/epan/dissectors/packet-rtsp.c b/epan/dissectors/packet-rtsp.c index 8463c7b16f..f5c5ca9e1e 100644 --- a/epan/dissectors/packet-rtsp.c +++ b/epan/dissectors/packet-rtsp.c @@ -156,12 +156,15 @@ dissect_rtspinterleaved(tvbuff_t *tvb, int offset, packet_info *pinfo, */ if (length_remaining < 4) { /* - * Yes. Tell the TCP dissector where the data - * for this message starts in the data it handed - * us, and how many more bytes we need, and return. + * Yes. Tell the TCP dissector where the data for + * this message starts in the data it handed us and + * that we need "some more data." Don't tell it + * exactly how many bytes we need because if/when we + * ask for even more (after the header) that will + * break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 4 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return -1; } } diff --git a/epan/dissectors/packet-snmp.c b/epan/dissectors/packet-snmp.c index e5a650ea3b..3c14c631a9 100644 --- a/epan/dissectors/packet-snmp.c +++ b/epan/dissectors/packet-snmp.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-snmp.c */ -/* ../../tools/asn2wrs.py -b -p snmp -c ./snmp.cnf -s ./packet-snmp-template -D . snmp.asn */ +/* ../../../tools/asn2wrs.py -b -p snmp -c ../../../asn1/snmp/snmp.cnf -s ../../../asn1/snmp/packet-snmp-template -D ../../../asn1/snmp snmp.asn */ /* Input file: packet-snmp-template.c */ @@ -2785,8 +2785,16 @@ dissect_snmp_pdu(tvbuff_t *tvb, int offset, packet_info *pinfo, * BER). */ if (length_remaining < 6) { + /* + * Yes. Tell the TCP dissector where the data + * for this message starts in the data it handed + * us and that we need "some more data." Don't tell + * it exactly how many bytes we need because if/when + * we ask for even more (after the header) that will + * break reassembly. + */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 6 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; /* * Return 0, which means "I didn't dissect anything @@ -3625,7 +3633,7 @@ void proto_register_snmp(void) { NULL, HFILL }}, /*--- End of included file: packet-snmp-hfarr.c ---*/ -#line 2140 "packet-snmp-template.c" +#line 2148 "packet-snmp-template.c" }; /* List of subtrees */ @@ -3665,7 +3673,7 @@ void proto_register_snmp(void) { &ett_snmp_RReqPDU_U, /*--- End of included file: packet-snmp-ettarr.c ---*/ -#line 2156 "packet-snmp-template.c" +#line 2164 "packet-snmp-template.c" }; module_t *snmp_module; diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c index b1a2053abd..93d7701a32 100644 --- a/epan/dissectors/packet-ssh.c +++ b/epan/dissectors/packet-ssh.c @@ -497,10 +497,25 @@ ssh_dissect_ssh1(tvbuff_t *tvb, packet_info *pinfo, * This means we're guaranteed that "remain_length" is positive. */ remain_length = tvb_ensure_length_remaining(tvb,offset); + /* + * Can we do reassembly? + */ if (ssh_desegment && pinfo->can_desegment) { + /* + * Yes - would an SSH header starting at this offset be split + * across segment boundaries? + */ if(remain_length < 4) { + /* + * Yes. Tell the TCP dissector where the data for + * this message starts in the data it handed us and + * that we need "some more data." Don't tell it + * exactly how many bytes we need because if/when we + * ask for even more (after the header) that will + * break reassembly. + */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 4-remain_length; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; *need_desegmentation = TRUE; return offset; } @@ -636,10 +651,25 @@ ssh_dissect_key_exchange(tvbuff_t *tvb, packet_info *pinfo, * This means we're guaranteed that "remain_length" is positive. */ remain_length = tvb_ensure_length_remaining(tvb,offset); + /* + * Can we do reassembly? + */ if (ssh_desegment && pinfo->can_desegment) { + /* + * Yes - would an SSH header starting at this offset + * be split across segment boundaries? + */ if(remain_length < 4) { + /* + * Yes. Tell the TCP dissector where the data for + * this message starts in the data it handed us and + * that we need "some more data." Don't tell it + * exactly how many bytes we need because if/when we + * ask for even more (after the header) that will + * break reassembly. + */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 4-remain_length; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; *need_desegmentation = TRUE; return offset; } diff --git a/epan/dissectors/packet-ssl.c b/epan/dissectors/packet-ssl.c index 203aaeaa32..39959e02c0 100644 --- a/epan/dissectors/packet-ssl.c +++ b/epan/dissectors/packet-ssl.c @@ -1322,12 +1322,10 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo, if (available_bytes < 5) { /* * Yes. Tell the TCP dissector where the data for this - * message starts in the data it handed us, and how many - * more bytes we need, and return. - * Fix for bug 4535: Don't get just the data we need, get - * one more segment. Otherwise when the next segment does - * not contain all the rest of the SSL PDU, reassembly will - * break. + * message starts in the data it handed us, and that we need + * "some more data." Don't tell it exactly how many bytes we + * need because if/when we ask for even more (after the header) + * that will break reassembly. */ pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; @@ -1366,7 +1364,8 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo, * the continuation of a previous PDU together with a full new * PDU (and the info column would not show the message type * of the second PDU) - */ + */ + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; *need_desegmentation = TRUE; return offset; @@ -2811,11 +2810,11 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, byte = tvb_get_guint8(tvb, offset); record_length_length = (byte & 0x80) ? 2 : 3; + available_bytes = tvb_length_remaining(tvb, offset); + /* * Can we do reassembly? */ - available_bytes = tvb_length_remaining(tvb, offset); - if (ssl_desegment && pinfo->can_desegment) { /* * Yes - is the record header split across segment boundaries? @@ -2823,11 +2822,13 @@ dissect_ssl2_record(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (available_bytes < record_length_length) { /* * Yes. Tell the TCP dissector where the data for this - * message starts in the data it handed us, and how many - * more bytes we need, and return. + * message starts in the data it handed us, and that we need + * "some more data." Don't tell it exactly how many bytes we + * need because if/when we ask for even more (after the header) + * that will break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = record_length_length - available_bytes; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; *need_desegmentation = TRUE; return offset; } diff --git a/epan/dissectors/packet-tcp.c b/epan/dissectors/packet-tcp.c index bd8dba4f15..4ce527e5d3 100644 --- a/epan/dissectors/packet-tcp.c +++ b/epan/dissectors/packet-tcp.c @@ -2070,8 +2070,10 @@ tcp_dissect_pdus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, if (length_remaining < fixed_len) { /* * Yes. Tell the TCP dissector where the data for this message - * starts in the data it handed us, and how many more bytes we - * need, and return. + * starts in the data it handed us and that we need "some more + * data." Don't tell it exactly how many bytes we need because + * if/when we ask for even more (after the header) that will + * break reassembly. */ pinfo->desegment_offset = offset; pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; diff --git a/epan/dissectors/packet-tds.c b/epan/dissectors/packet-tds.c index 0550096fe3..2686fbcaf1 100644 --- a/epan/dissectors/packet-tds.c +++ b/epan/dissectors/packet-tds.c @@ -2402,14 +2402,15 @@ dissect_tds_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) * split across segment boundaries? */ if (length_remaining < 8) { - /* - * Yes. Tell the TCP dissector where the - * data for this message starts in the data - * it handed us, and how many more bytes we - * need, and return. - */ + /* + * Yes. Tell the TCP dissector where the data for this message + * starts in the data it handed us and that we need "some more + * data." Don't tell it exactly how many bytes we need because + * if/when we ask for even more (after the header) that will + * break reassembly. + */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 8 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } diff --git a/epan/dissectors/packet-tpkt.c b/epan/dissectors/packet-tpkt.c index 40ddb58a74..d5001a6282 100644 --- a/epan/dissectors/packet-tpkt.c +++ b/epan/dissectors/packet-tpkt.c @@ -432,13 +432,15 @@ dissect_tpkt_encap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, */ if (length_remaining < 4) { /* - * Yes. Tell the TCP dissector where - * the data for this message starts in - * the data it handed us, and how many - * more bytes we need, and return. + * Yes. Tell the TCP dissector where the data + * for this message starts in the data it + * handed us and that we need "some more data." + * Don't tell it exactly how many bytes we need + * because if/when we ask for even more (after + * the header) that will break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 4 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } diff --git a/epan/dissectors/packet-x11.c b/epan/dissectors/packet-x11.c index a05dc2a814..f700b8a77c 100644 --- a/epan/dissectors/packet-x11.c +++ b/epan/dissectors/packet-x11.c @@ -4338,10 +4338,13 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo, /* * Yes. Tell the TCP dissector where the data * for this message starts in the data it handed - * us, and how many more bytes we need, and return. + * us and that we need "some more data." Don't tell + * it exactly how many bytes we need because if/when + * we ask for even more (after the header) that will + * break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 4 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } @@ -4450,11 +4453,13 @@ static void dissect_x11_requests(tvbuff_t *tvb, packet_info *pinfo, /* * Yes. Tell the TCP dissector where the * data for this message starts in the data - * it handed us, and how many more bytes we - * need, and return. + * it handed us and that we need "some more + * data." Don't tell it exactly how many bytes + * we need because if/when we ask for even more + * (after the header) that will break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 10 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } @@ -4699,11 +4704,13 @@ dissect_x11_replies(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* * Yes. Tell the TCP dissector where the data * for this message starts in the data it handed - * us, and how many more bytes we need, and - * return. + * us and that we need "some more data." Don't tell + * it exactly how many bytes we need because if/when + * we ask for even more (after the header) that will + * break reassembly. */ pinfo->desegment_offset = offset; - pinfo->desegment_len = 8 - length_remaining; + pinfo->desegment_len = DESEGMENT_ONE_MORE_SEGMENT; return; } } |