Check size of partition before using it.

This commit is contained in:
Robert Nordier 1999-01-29 03:36:42 +00:00
parent 2d4a17e638
commit 391911b768
2 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,7 @@
*/
/*
* $Id: boot2.c,v 1.18 1999/01/11 11:36:03 rnordier Exp $
* $Id: boot2.c,v 1.19 1999/01/24 00:10:10 msmith Exp $
*/
#include <sys/param.h>
@ -571,7 +571,8 @@ dskread(void *buf, unsigned lba, unsigned nblk)
dsk.type = MAJ_DA;
dsk.init++;
}
if (dsk.part >= d->d_npartitions) {
if (dsk.part >= d->d_npartitions ||
!d->d_partitions[dsk.part].p_size) {
printf("Invalid %s\n", "partition");
return -1;
}

View File

@ -14,7 +14,7 @@
*/
/*
* $Id: boot2.c,v 1.18 1999/01/11 11:36:03 rnordier Exp $
* $Id: boot2.c,v 1.19 1999/01/24 00:10:10 msmith Exp $
*/
#include <sys/param.h>
@ -571,7 +571,8 @@ dskread(void *buf, unsigned lba, unsigned nblk)
dsk.type = MAJ_DA;
dsk.init++;
}
if (dsk.part >= d->d_npartitions) {
if (dsk.part >= d->d_npartitions ||
!d->d_partitions[dsk.part].p_size) {
printf("Invalid %s\n", "partition");
return -1;
}