diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-03-05 20:25:59 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-03-05 20:25:59 +0000 |
commit | 169be53c11fe9c5135d0f981ed950386030f92e9 (patch) | |
tree | 9f3e4a36319b0b42da7cdb1248927996907724b2 /packet-scsi.c | |
parent | ff1c297602f13c0b5385b09d6878b673f7fdcdb7 (diff) |
Make various variables containing unsigned quantities unsigned.
Check whether a device identifier in a vital product data page (not a
vital data product page, although I guess most SCSI devices could be
considered data products) is bigger than the page before displaying it.
Don't bother to check whether the full identifier is in the packet - if
it's not, an exception will be thrown and an error indication put into
the protocol tree, which is the correct thing to do. Do, however, check
whether the identifier length is 0 before putting a protocol tree entry
in.
svn path=/trunk/; revision=7290
Diffstat (limited to 'packet-scsi.c')
-rw-r--r-- | packet-scsi.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/packet-scsi.c b/packet-scsi.c index 69f0228b33..50f5965ea6 100644 --- a/packet-scsi.c +++ b/packet-scsi.c @@ -2,7 +2,7 @@ * Routines for decoding SCSI CDBs and responses * Author: Dinesh G Dutt (ddutt@cisco.com) * - * $Id: packet-scsi.c,v 1.24 2003/03/05 07:41:24 guy Exp $ + * $Id: packet-scsi.c,v 1.25 2003/03/05 20:25:59 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -427,7 +427,7 @@ static const value_string scsi_smc2_val[] = { }; static const value_string scsi_evpd_pagecode_val[] = { - {0x00, "Supported Vital Data Product Pages"}, + {0x00, "Supported Vital Product Data Pages"}, {0x80, "Unit Serial Number Page"}, {0x82, "ASCII Implemented Operating Definition Page"}, {0x01, "ASCII Information Page"}, @@ -1377,7 +1377,7 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, { proto_tree *evpd_tree; proto_item *ti; - gint pcode, plen, i, idlen; + guint pcode, plen, i, idlen; guint8 flags; char str[256+1]; @@ -1412,7 +1412,7 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } break; case SCSI_EVPD_DEVID: - while (plen > 0) { + while (plen != 0) { flags = tvb_get_guint8 (tvb, offset); proto_tree_add_text (evpd_tree, tvb, offset, 1, "Code Set: %s", @@ -1431,9 +1431,15 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, scsi_devid_idtype_val, "Unknown (0x%02x)")); idlen = tvb_get_guint8 (tvb, offset+3); + if (idlen > plen) { + proto_tree_add_text (evpd_tree, tvb, offset+3, 1, + "Identifier Length: %u (greater than page length %u", + idlen, plen); + break; + } proto_tree_add_text (evpd_tree, tvb, offset+3, 1, "Identifier Length: %u", idlen); - if (tvb_bytes_exist (tvb, offset+4, idlen)) { + if (idlen != 0) { proto_tree_add_text (evpd_tree, tvb, offset+4, idlen, "Identifier: %s", tvb_bytes_to_str (tvb, offset+4, |