diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-03-19 11:55:59 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-03-19 11:55:59 +0000 |
commit | ba550773f30057b5053b3115a9e299e3d8cd0a7e (patch) | |
tree | 40680a8bf79a5e9454c4bac411f90623b68c76e0 | |
parent | 3c0c3ed835bc210015933aec2c62af142a112a4b (diff) |
Make amd64/i386 installboot error out if /boot would cross the
BOOTBIOS_MAXSEC line.
ok deraadt@.
-rw-r--r-- | sys/arch/amd64/stand/installboot/installboot.c | 6 | ||||
-rw-r--r-- | sys/arch/i386/stand/installboot/installboot.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/sys/arch/amd64/stand/installboot/installboot.c b/sys/arch/amd64/stand/installboot/installboot.c index 837d2fc3cc7..1f89c270823 100644 --- a/sys/arch/amd64/stand/installboot/installboot.c +++ b/sys/arch/amd64/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.17 2011/03/17 12:53:44 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.18 2011/03/19 11:55:58 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -240,6 +240,10 @@ write_bootblocks(int devfd, struct disklabel *dl) errx(1, "no OpenBSD partition"); } + if (start + (protosize / DEV_BSIZE) > BOOTBIOS_MAXSEC) + errx(1, "invalid location: all of /boot must be < sector %u.", + BOOTBIOS_MAXSEC); + if (verbose) fprintf(stderr, "/boot will be written at sector %u\n", start); diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c index edc4aa6626d..85fdb19948b 100644 --- a/sys/arch/i386/stand/installboot/installboot.c +++ b/sys/arch/i386/stand/installboot/installboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: installboot.c,v 1.60 2011/03/17 12:53:44 krw Exp $ */ +/* $OpenBSD: installboot.c,v 1.61 2011/03/19 11:55:58 krw Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -236,6 +236,10 @@ write_bootblocks(int devfd, struct disklabel *dl) errx(1, "no OpenBSD partition"); } + if (start + (protosize / DEV_BSIZE) > BOOTBIOS_MAXSEC) + errx(1, "invalid location: all of /boot must be < sector %u.", + BOOTBIOS_MAXSEC); + if (verbose) fprintf(stderr, "/boot will be written at sector %u\n", start); |