Skip to content

Commit

Permalink
osst: fix read buffer overflow
Browse files Browse the repository at this point in the history
Check whether index is within bounds before testing the element.

Signed-off-by: Roel Kluin <[email protected]>
Cc: Willem Riede <[email protected]>
Cc: James E.J. Bottomley <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
RoelKluin authored and torvalds committed Aug 11, 2010
1 parent 13bcbc0 commit ef3f7cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/scsi/osst.c
Original file line number Diff line number Diff line change
Expand Up @@ -5868,7 +5868,8 @@ static int osst_probe(struct device *dev)
}

/* find a free minor number */
for (i=0; os_scsi_tapes[i] && i<osst_max_dev; i++);
for (i = 0; i < osst_max_dev && os_scsi_tapes[i]; i++)
;
if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)");
dev_num = i;

Expand Down

0 comments on commit ef3f7cc

Please sign in to comment.