aboutsummaryrefslogtreecommitdiffstats
path: root/packet-scsi.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2003-05-19 03:23:12 +0000
committerGerald Combs <gerald@wireshark.org>2003-05-19 03:23:12 +0000
commit7a132e5b48db1f5fea29d461daa8d3a481432918 (patch)
tree52efc6af782789bdc73143e570d7f654e6799987 /packet-scsi.c
parenta53a260f3c9f6a3bc0ac3ab4ec824f4b39a82ef0 (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. svn path=/trunk/; revision=7688
Diffstat (limited to 'packet-scsi.c')
-rw-r--r--packet-scsi.c8
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;
}
}