diff options
author | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-05-19 03:23:12 +0000 |
---|---|---|
committer | gerald <gerald@f5534014-38df-0310-8fa8-9805f1628bb7> | 2003-05-19 03:23:12 +0000 |
commit | e93428cd1230d00b87fe3c71d73392d23ee3e497 (patch) | |
tree | 52efc6af782789bdc73143e570d7f654e6799987 /packet-scsi.c | |
parent | 799dc39b7a7ce7df50607f4fdbafe70b6e2f023d (diff) |
More tvb_get_nstringz0() fixes. Timo Sirainen pointed out that Bad
Things can happen if we pass a zero buffer length to tvb_get_nstringz0().
Throw an exception if this happens.
In various dissectors make sure the tvb_get_nstringz0()'s buffer length
is greater than zero.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7688 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-scsi.c')
-rw-r--r-- | packet-scsi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/packet-scsi.c b/packet-scsi.c index 5853d38c81..6d72348e29 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.29 2003/04/30 02:35:19 gerald Exp $ + * $Id: packet-scsi.c,v 1.30 2003/05/19 03:23:11 gerald Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -1500,9 +1500,11 @@ dissect_scsi_evpd (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, } break; case SCSI_EVPD_DEVSERNUM: - tvb_get_nstringz0 (tvb, offset, MIN(plen, sizeof(str)), str); - proto_tree_add_text (evpd_tree, tvb, offset, plen, + if (plen > 0) { + tvb_get_nstringz0 (tvb, offset, MIN(plen, sizeof(str)), str); + proto_tree_add_text (evpd_tree, tvb, offset, plen, "Product Serial Number: %s", str); + } break; } } |