ssl,dtls: convert from tvb_length

Every occurrence of tvb_length* has been converted to
tvb_reported_length* except some dtls lines.

Change-Id: I0faac315cdf5d17c0af18be177aacd076ff86cff
Reviewed-on: https://code.wireshark.org/review/2977
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
This commit is contained in:
Peter Wu 2014-07-08 18:34:04 +02:00 committed by Alexis La Goutte
parent e1bad3cd9b
commit 1bf4efd850
2 changed files with 12 additions and 12 deletions

View File

@ -528,7 +528,7 @@ dissect_dtls(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* looks like something unknown, so lump into
* continuation data
*/
offset = tvb_length(tvb);
offset = tvb_reported_length(tvb);
col_append_str(pinfo->cinfo, COL_INFO,
"Continuation Data");
@ -551,7 +551,7 @@ dissect_dtls_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
{
/* Stronger confirmation of DTLS packet is provided by verifying the
* captured payload length against the remainder of the UDP packet size. */
guint length = tvb_length(tvb);
guint length = tvb_captured_length(tvb);
guint offset = 0;
if (tvb_reported_length(tvb) == length) {
@ -574,12 +574,12 @@ dissect_dtls_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
/* This packet was truncated by the capture process due to a snapshot
* length - do our best with what we've got. */
while (tvb_length_remaining(tvb, offset) >= 3) {
while (tvb_captured_length_remaining(tvb, offset) >= 3) {
if (!looks_like_dtls(tvb, offset))
return FALSE;
offset += 3;
if (tvb_length_remaining(tvb, offset) >= 10 ) {
if (tvb_captured_length_remaining(tvb, offset) >= 10 ) {
offset += tvb_get_ntohs(tvb, offset + 8) + 10;
} else {
/* Dissect what we've got, which might be as little as 3 bytes. */
@ -923,7 +923,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
decrypted = ssl_get_record_info(tvb, proto_dtls, pinfo, offset);
if (decrypted) {
dissect_dtls_handshake(decrypted, pinfo, dtls_record_tree, 0,
tvb_length(decrypted), session, is_from_server,
tvb_reported_length(decrypted), session, is_from_server,
ssl, content_type);
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
} else {
@ -1017,7 +1017,7 @@ dissect_dtls_record(tvbuff_t *tvb, packet_info *pinfo,
decrypted = ssl_get_record_info(tvb, proto_dtls, pinfo, offset);
if (decrypted) {
dissect_dtls_heartbeat(decrypted, pinfo, dtls_record_tree, 0,
session, tvb_length (decrypted), TRUE);
session, tvb_reported_length (decrypted), TRUE);
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
} else {
dissect_dtls_heartbeat(tvb, pinfo, dtls_record_tree, offset,

View File

@ -799,7 +799,7 @@ dissect_ssl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* looks like something unknown, so lump into
* continuation data
*/
offset = tvb_length(tvb);
offset = tvb_reported_length(tvb);
col_append_str(pinfo->cinfo, COL_INFO,
"Continuation Data");
@ -972,7 +972,7 @@ again:
*/
if (msp->flags & MSP_FLAGS_REASSEMBLE_ENTIRE_SEGMENT) {
/* The dissector asked for the entire segment */
len = MAX(0, tvb_length_remaining(tvb, offset));
len = MAX(0, tvb_reported_length_remaining(tvb, offset));
} else {
len = MIN(nxtseq, msp->nxtpdu) - seq;
}
@ -1423,7 +1423,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
ti = NULL;
ssl_record_tree = NULL;
available_bytes = tvb_length_remaining(tvb, offset);
available_bytes = tvb_reported_length_remaining(tvb, offset);
/* TLS 1.0/1.1 just ignores unknown records - RFC 2246 chapter 6. The TLS Record Protocol */
if ((session->version==SSL_VER_TLS || session->version==SSL_VER_TLSv1DOT1 || session->version==SSL_VER_TLSv1DOT2) &&
@ -1665,7 +1665,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
/* add desegmented data to the data source list */
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
dissect_ssl3_handshake(decrypted, pinfo, ssl_record_tree, 0,
tvb_length(decrypted), session,
tvb_reported_length(decrypted), session,
is_from_server, ssl, content_type);
} else {
dissect_ssl3_handshake(tvb, pinfo, ssl_record_tree, offset,
@ -1719,7 +1719,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
decrypted = ssl_get_record_info(tvb, proto_ssl, pinfo, offset);
if (decrypted) {
add_new_data_source(pinfo, decrypted, "Decrypted SSL record");
dissect_ssl3_heartbeat(decrypted, pinfo, ssl_record_tree, 0, session, tvb_length (decrypted), TRUE);
dissect_ssl3_heartbeat(decrypted, pinfo, ssl_record_tree, 0, session, tvb_reported_length (decrypted), TRUE);
} else {
gboolean plaintext = TRUE;
/* heartbeats before ChangeCipherSpec are unencrypted */
@ -2909,7 +2909,7 @@ 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);
available_bytes = tvb_reported_length_remaining(tvb, offset);
/*
* Is the record header split across segment boundaries?