Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1271971
| From | Finn Thain <fthain@telegraphics.com.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 44/71] ncr5380: Fix off-by-one bug in extended_msg[] bounds check |
| Date | 2015-11-18 10:00 +0100 |
| Message-ID | <qw6KT-Af-39@gated-at.bofh.it> (permalink) |
| References | <qw6Bc-vx-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Fix the array bounds check when transferring an extended message from the
target.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
drivers/scsi/NCR5380.c | 3 ++-
drivers/scsi/atari_NCR5380.c | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c 2015-11-18 19:33:59.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c 2015-11-18 19:34:00.000000000 +1100
@@ -2034,7 +2034,8 @@ static void NCR5380_information_transfer
dprintk(NDEBUG_EXTENDED, "scsi%d : length=%d, code=0x%02x\n", instance->host_no, (int) extended_msg[1], (int) extended_msg[2]);
- if (!len && extended_msg[1] <= (sizeof(extended_msg) - 1)) {
+ if (!len && extended_msg[1] > 0 &&
+ extended_msg[1] <= sizeof(extended_msg) - 2) {
/* Accept third byte by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
len = extended_msg[1] - 1;
Index: linux/drivers/scsi/atari_NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/atari_NCR5380.c 2015-11-18 19:33:59.000000000 +1100
+++ linux/drivers/scsi/atari_NCR5380.c 2015-11-18 19:34:00.000000000 +1100
@@ -2326,8 +2326,8 @@ static void NCR5380_information_transfer
dprintk(NDEBUG_EXTENDED, "scsi%d: length=%d, code=0x%02x\n", HOSTNO,
(int)extended_msg[1], (int)extended_msg[2]);
- if (!len && extended_msg[1] <=
- (sizeof(extended_msg) - 1)) {
+ if (!len && extended_msg[1] > 0 &&
+ extended_msg[1] <= sizeof(extended_msg) - 2) {
/* Accept third byte by clearing ACK */
NCR5380_write(INITIATOR_COMMAND_REG, ICR_BASE);
len = extended_msg[1] - 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 44/71] ncr5380: Fix off-by-one bug in extended_msg[] bounds check Finn Thain <fthain@telegraphics.com.au> - 2015-11-18 10:00 +0100
csiph-web