Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef3f7cc4 authored by Roel Kluin's avatar Roel Kluin Committed by Linus Torvalds
Browse files

osst: fix read buffer overflow



Check whether index is within bounds before testing the element.

Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Cc: Willem Riede <osst@riede.org>
Cc: James E.J. Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 13bcbc00
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -5868,7 +5868,8 @@ static int osst_probe(struct device *dev)
	}
	}


	/* find a free minor number */
	/* 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)");
	if(i >= osst_max_dev) panic ("Scsi_devices corrupt (osst)");
	dev_num = i;
	dev_num = i;