RSVD: fix TUNNEL_SCSI_REQUEST
authorVolodymyr Khomenko <Volodymyr_Khomenko@DellTeam.com>
Fri, 13 Jan 2017 13:54:51 +0000 (15:54 +0200)
committerAnders Broman <a.broman58@gmail.com>
Mon, 16 Jan 2017 16:05:59 +0000 (16:05 +0000)
Length of CDBBuffer must be always 16 bytes
If CDBLength is less than 16, add padding bytes

Change-Id: I241a10325ebe17b32469eaf7dc530fc7fe2105de
Reviewed-on: https://code.wireshark.org/review/19628
Petri-Dish: Pascal Quantin <pascal.quantin@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-rsvd.c

index 64507234b19e010141e197ecaf2e8e4b8c4ad6df..d948315c507aa998082d0cd37e1e7a8f7c7ba9c7 100644 (file)
@@ -51,6 +51,7 @@ static int hf_svhdx_tunnel_scsi_srb_flags = -1;
 static int hf_svhdx_tunnel_scsi_data_transfer_length = -1;
 static int hf_svhdx_tunnel_scsi_reserved3 = -1;
 static int hf_svhdx_tunnel_scsi_cdb = -1;
+static int hf_svhdx_tunnel_scsi_cdb_padding = -1;
 static int hf_svhdx_tunnel_scsi_data = -1;
 static int hf_svhdx_tunnel_scsi_auto_generated_sense = -1;
 static int hf_svhdx_tunnel_scsi_srb_status = -1;
@@ -264,6 +265,15 @@ dissect_RSVD_TUNNEL_SCSI(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *pare
                                   tvb_reported_length_remaining(tvb, offset));
         proto_tree_add_item(sub_tree, hf_svhdx_tunnel_scsi_cdb, tvb, offset, cdb_length, ENC_NA);
         offset += cdb_length;
+        if (cdb_length < 16) {
+            /*
+             * CDBBuffer is always 16 bytes - see https://msdn.microsoft.com/en-us/library/dn393496.aspx
+             * If CDB is actually smaller, we need to define padding bytes
+             */
+            guint32 cdb_padding_length = 16 - cdb_length;
+            proto_tree_add_item(sub_tree, hf_svhdx_tunnel_scsi_cdb_padding, tvb, offset, cdb_padding_length, ENC_NA);
+            offset += cdb_padding_length;
+        }
 
         /* Reserved3 */
         proto_tree_add_item(sub_tree, hf_svhdx_tunnel_scsi_reserved3, tvb, offset, 4, ENC_LITTLE_ENDIAN);
@@ -701,6 +711,10 @@ proto_register_rsvd(void)
                   { "CDB", "rsvd.svhdx_scsi_cdb", FT_BYTES, BASE_NONE,
                     NULL, 0, NULL, HFILL }},
 
+                { &hf_svhdx_tunnel_scsi_cdb_padding,
+                  { "CDBPadding", "rsvd.svhdx_scsi_cdb_padding", FT_BYTES, BASE_NONE,
+                    NULL, 0, NULL, HFILL }},
+
                 { &hf_svhdx_tunnel_scsi_data,
                   {"Data", "rsvd.svhdx_scsi_data", FT_BYTES, BASE_NONE,
                     NULL, 0, NULL, HFILL }},