diff options
author | rnordier <rnordier@FreeBSD.org> | 1999-01-29 03:36:42 +0000 |
---|---|---|
committer | rnordier <rnordier@FreeBSD.org> | 1999-01-29 03:36:42 +0000 |
commit | c84955e100569c0feea1d69b5439528f7d10e56e (patch) | |
tree | ca9b8c7d7c121a7841ed2ce599809d0c03ecd010 /sys | |
parent | 7bd388480022fbee6abc22a79e75f6ddec8d86f4 (diff) | |
download | FreeBSD-src-c84955e100569c0feea1d69b5439528f7d10e56e.zip FreeBSD-src-c84955e100569c0feea1d69b5439528f7d10e56e.tar.gz |
Check size of partition before using it.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/boot/i386/boot2/boot2.c | 5 | ||||
-rw-r--r-- | sys/boot/i386/gptboot/gptboot.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/sys/boot/i386/boot2/boot2.c b/sys/boot/i386/boot2/boot2.c index ddd0316..cc20a92 100644 --- a/sys/boot/i386/boot2/boot2.c +++ b/sys/boot/i386/boot2/boot2.c @@ -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; } diff --git a/sys/boot/i386/gptboot/gptboot.c b/sys/boot/i386/gptboot/gptboot.c index ddd0316..cc20a92 100644 --- a/sys/boot/i386/gptboot/gptboot.c +++ b/sys/boot/i386/gptboot/gptboot.c @@ -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; } |