packet-ldap: use the correct tvb to report the SASL wrapped payload
authorStefan Metzmacher <metze@samba.org>
Sat, 21 Feb 2015 22:06:56 +0000 (23:06 +0100)
committerMichael Mann <mmann78@netscape.net>
Tue, 10 Mar 2015 13:00:56 +0000 (13:00 +0000)
Ping-Bug: 9398
Change-Id: I163d3dc99562b3388470c58d05e2d4d2e2f6d00c
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-on: https://code.wireshark.org/review/7477
Reviewed-by: Michael Mann <mmann78@netscape.net>
asn1/ldap/packet-ldap-template.c
epan/dissectors/packet-ldap.c

index 81828c949ca5cff08b45eb23a33fd92dc20a5b77..2fae157d9be1be1dc57f011868444b4a30f017b2 100644 (file)
@@ -1229,6 +1229,7 @@ static void
 
                                if (decr_tvb) {
                                        proto_tree *enc_tree = NULL;
+                                       guint decr_len = tvb_reported_length(decr_tvb);
 
                                        /*
                                        * The LDAP message was encrypted in the packet, and has
@@ -1237,14 +1238,14 @@ static void
                                        col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy (decrypted): ");
 
                                        if (sasl_tree) {
-                                               enc_tree = proto_tree_add_subtree_format(sasl_tree, gssapi_tvb, ver_len, -1,
+                                               enc_tree = proto_tree_add_subtree_format(sasl_tree, decr_tvb, 0, -1,
                                                        ett_ldap_payload, NULL, "GSS-API Encrypted payload (%d byte%s)",
-                                                       sasl_len - ver_len,
-                                                       plurality(sasl_len - ver_len, "", "s"));
+                                                       decr_len, plurality(decr_len, "", "s"));
                                        }
                                        dissect_ldap_payload(decr_tvb, pinfo, enc_tree, ldap_info, is_mscldap);
                                } else if (plain_tvb) {
                                        proto_tree *plain_tree = NULL;
+                                       guint plain_len = tvb_reported_length(plain_tvb);
 
                                        /*
                                        * The LDAP message wasn't encrypted in the packet;
@@ -1253,10 +1254,9 @@ static void
                                        col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Integrity: ");
 
                                        if (sasl_tree) {
-                                               plain_tree = proto_tree_add_subtree_format(sasl_tree, gssapi_tvb, ver_len, -1,
+                                               plain_tree = proto_tree_add_subtree_format(sasl_tree, plain_tvb, 0, -1,
                                                        ett_ldap_payload, NULL, "GSS-API payload (%d byte%s)",
-                                                       sasl_len - ver_len,
-                                                       plurality(sasl_len - ver_len, "", "s"));
+                                                       plain_len, plurality(plain_len, "", "s"));
                                        }
 
                                        dissect_ldap_payload(plain_tvb, pinfo, plain_tree, ldap_info, is_mscldap);
index 9077578904a3b7a5457d349a43ca75d0f3dab283..ffa3087e8a94588f8b87b5af95e48422fffb8018 100644 (file)
@@ -4157,6 +4157,7 @@ static void
 
                                if (decr_tvb) {
                                        proto_tree *enc_tree = NULL;
+                                       guint decr_len = tvb_reported_length(decr_tvb);
 
                                        /*
                                        * The LDAP message was encrypted in the packet, and has
@@ -4165,14 +4166,14 @@ static void
                                        col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Privacy (decrypted): ");
 
                                        if (sasl_tree) {
-                                               enc_tree = proto_tree_add_subtree_format(sasl_tree, gssapi_tvb, ver_len, -1,
+                                               enc_tree = proto_tree_add_subtree_format(sasl_tree, decr_tvb, 0, -1,
                                                        ett_ldap_payload, NULL, "GSS-API Encrypted payload (%d byte%s)",
-                                                       sasl_len - ver_len,
-                                                       plurality(sasl_len - ver_len, "", "s"));
+                                                       decr_len, plurality(decr_len, "", "s"));
                                        }
                                        dissect_ldap_payload(decr_tvb, pinfo, enc_tree, ldap_info, is_mscldap);
                                } else if (plain_tvb) {
                                        proto_tree *plain_tree = NULL;
+                                       guint plain_len = tvb_reported_length(plain_tvb);
 
                                        /*
                                        * The LDAP message wasn't encrypted in the packet;
@@ -4181,10 +4182,9 @@ static void
                                        col_set_str(pinfo->cinfo, COL_INFO, "SASL GSS-API Integrity: ");
 
                                        if (sasl_tree) {
-                                               plain_tree = proto_tree_add_subtree_format(sasl_tree, gssapi_tvb, ver_len, -1,
+                                               plain_tree = proto_tree_add_subtree_format(sasl_tree, plain_tvb, 0, -1,
                                                        ett_ldap_payload, NULL, "GSS-API payload (%d byte%s)",
-                                                       sasl_len - ver_len,
-                                                       plurality(sasl_len - ver_len, "", "s"));
+                                                       plain_len, plurality(plain_len, "", "s"));
                                        }
 
                                        dissect_ldap_payload(plain_tvb, pinfo, plain_tree, ldap_info, is_mscldap);