From b412b99609d5be744e1fc32b34e79e9dc14251cb Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 13 Jun 2002 07:36:52 +0000 Subject: From Peter Hawkins: make the maximum length argument to "tvb_get_nstringz0()" no larger than the space in "str" (not counting the space for the trailing '\0'). Make "str" big enough to hold a maximum-length serial number string (the length is 1 byte, hence the maximum length is 256 bytes plus 1 byte of terminating '\0'). svn path=/trunk/; revision=5665 --- packet-scsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packet-scsi.c') diff --git a/packet-scsi.c b/packet-scsi.c index f16d80f3dc..9a78a4e895 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.9 2002/04/14 23:04:04 guy Exp $ + * $Id: packet-scsi.c,v 1.10 2002/06/13 07:36:52 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1279,7 +1279,7 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *ti; guint pcode, plen, i, idlen; guint8 flags; - char str[32]; + char str[256+1]; if (tree) { pcode = tvb_get_guint8 (tvb, offset+1); @@ -1343,7 +1343,7 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, break; case SCSI_EVPD_DEVSERNUM: str[0] = '\0'; - tvb_get_nstringz0 (tvb, offset, plen, str); + tvb_get_nstringz0 (tvb, offset, MIN(plen, sizeof(str) - 1), str); proto_tree_add_text (evpd_tree, tvb, offset, plen, "Product Serial Number: %s", str); break; -- cgit v1.2.3