SSL: Send the record_length to the dissect_ssl3_alert and use it
authorEugene Adell <eugene.adell@gmail.com>
Sun, 20 May 2018 10:57:42 +0000 (03:57 -0700)
committerPeter Wu <peter@lekensteyn.nl>
Fri, 25 May 2018 19:43:23 +0000 (19:43 +0000)
Bug: 14712
Change-Id: I3550f0da76a9acd3619d243b5a6e1d04d6734b62
Reviewed-on: https://code.wireshark.org/review/27670
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
epan/dissectors/packet-ssl.c

index c8322ebb2793926655013548da92c971e6eb0470..17140639385d9dac009d54e7d813c0b0c8336d00 100644 (file)
@@ -543,7 +543,7 @@ static gint dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
 /* alert message dissector */
 static void dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
                                proto_tree *tree, guint32 offset,
-                               const SslSession *session);
+                               guint32 record_length, const SslSession *session);
 
 /* handshake protocol dissector */
 static void dissect_ssl3_handshake(tvbuff_t *tvb, packet_info *pinfo,
@@ -1956,9 +1956,9 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
         break;
     case SSL_ID_ALERT:
         if (decrypted) {
-            dissect_ssl3_alert(decrypted, pinfo, ssl_record_tree, 0, session);
+            dissect_ssl3_alert(decrypted, pinfo, ssl_record_tree, 0, 2, session);
         } else {
-            dissect_ssl3_alert(tvb, pinfo, ssl_record_tree, offset, session);
+            dissect_ssl3_alert(tvb, pinfo, ssl_record_tree, offset, record_length, session);
         }
         break;
     case SSL_ID_HANDSHAKE:
@@ -2044,7 +2044,7 @@ dissect_ssl3_record(tvbuff_t *tvb, packet_info *pinfo,
 /* dissects the alert message, filling in the tree */
 static void
 dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
-                   proto_tree *tree, guint32 offset,
+                   proto_tree *tree, guint32 offset, guint32 record_length,
                    const SslSession *session)
 {
     /*     struct {
@@ -2062,7 +2062,7 @@ dissect_ssl3_alert(tvbuff_t *tvb, packet_info *pinfo,
     if (tree)
     {
         ti = proto_tree_add_item(tree, hf_ssl_alert_message, tvb,
-                                 offset, 2, ENC_NA);
+                                 offset, record_length, ENC_NA);
         ssl_alert_tree = proto_item_add_subtree(ti, ett_ssl_alert);
     }