Wireshark-dev: [Wireshark-dev] [patch] Fix SCSI SSC space 6 command

From: Patrick vd Lageweg <patrick@xxxxxxxxxxxx>
Date: Thu, 16 Nov 2006 10:11:59 +0100
Hi,

The SCSI SSC space comand count field is in the two's complement notation. This patch gives the correct negative values for the count field.

	Patrick
Index: packet-scsi.c
===================================================================
--- packet-scsi.c	(revision 19908)
+++ packet-scsi.c	(working copy)
@@ -4776,6 +4776,7 @@
                     guint payload_len _U_, scsi_task_data_t *cdata _U_)
 {
     guint8 flags;
+    gint32 count;
 
     if (isreq && iscdb) {
         if (!tree)
@@ -4786,8 +4787,16 @@
                              "CODE: %u",
                              flags & 0x0f);
 
-        proto_tree_add_item (tree, hf_ssc3_space6_count, tvb, offset+1, 3, 0);
+	count = tvb_get_ntohl (tvb, offset);
+	count = count & 0x00ffffff;
+	if (count > (0xffffff - 0x700000)) {
+		count = count - 0xffffff - 1;
+	}
 
+	proto_tree_add_text (tree, tvb, offset+1, 3,
+			     "Count: %d",
+			     count);
+
         flags = tvb_get_guint8 (tvb, offset+4);
         proto_tree_add_uint_format (tree, hf_scsi_control, tvb, offset+4, 1,
                                     flags,