Ethereal-dev: Re: [Ethereal-dev] Additional commands dissected in SCSI

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Mon, 27 Oct 2003 20:01:22 -0800

On Oct 25, 2003, at 9:39 PM, Dinesh G Dutt wrote:

This patch adds dissection code for the following additional SCSI commands:
     - Start/Stop Unit
     - Write Buffer
     - Send Diagnostics

It also contains a cleaned up patch for displaying the serial number EVPD.

Checked in, with additional _U_'s for added freshness^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^H^Hto squelch GCC warnings about unused arguments, "scsi_senddiag_pf_val" made a scalar rather than an array, and:

***************
*** 1508,1515 ****
              break;
          case SCSI_EVPD_DEVSERNUM:
              if (plen > 0) {
! tvb_memcpy (tvb, str, offset, MIN(plen, sizeof(str) - 1));
!                 str[sizeof(str) - 1] = '\0';
                  proto_tree_add_text (evpd_tree, tvb, offset, plen,
"Product Serial Number: %s", str);
              }
--- 1568,1574 ----
              break;
          case SCSI_EVPD_DEVSERNUM:
              if (plen > 0) {
!                 str = tvb_get_ptr (tvb, offset, plen);
                  proto_tree_add_text (evpd_tree, tvb, offset, plen,
"Product Serial Number: %s", str);

"%.*s", with an additional argument of "plen", used, just in case the serial number *doesn't* have its last byte 0. ("tvb_get_string()" could have been used as well, although you have to assign the return value to a pointer, and "g_free()" the pointer when you're done.)