diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-24 03:39:53 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2005-08-24 03:39:53 +0000 |
commit | e43eff62dc2370451bf18d1e2f3ee90b31f35393 (patch) | |
tree | e745c199f698171be79c7d02687d6204ab3ac118 /sys/scsi | |
parent | efa8667a804bfacc409a408004fb6e652d415407 (diff) |
dont reject safte devices that have more inquiry information than the
space we want to store it in. thanks to mtu for providing access to
hardware for this.
ok deraadt@
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/safte.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index 8d648a25130..d2e6dcd9525 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.15 2005/08/23 05:29:42 marco Exp $ */ +/* $OpenBSD: safte.c,v 1.16 2005/08/24 03:39:52 dlg Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -144,8 +144,11 @@ safte_match(struct device *parent, void *match, void *aux) memset(&cmd, 0, sizeof(cmd)); cmd.opcode = INQUIRY; cmd.length = inq->additional_length + SAFTE_EXTRA_OFFSET; - if (cmd.length > sizeof(inqbuf) || cmd.length < SAFTE_INQ_LEN) - return(0); + if (cmd.length < SAFTE_INQ_LEN) + return (0); + + if (cmd.length > sizeof(inqbuf)) + cmd.length = sizeof(inqbuf); memset(&inqbuf, 0, sizeof(inqbuf)); memset(&inqbuf.extra, ' ', sizeof(inqbuf.extra)); |