From 47dd934cb84b71e78e79df9251cfc2ab126aaf22 Mon Sep 17 00:00:00 2001 From: Tom Cosgrove Date: Tue, 20 Jan 2004 23:02:27 +0000 Subject: Check the values given to -h and -s. Closes PR 3640. ok weingart@, deraadt@ --- sys/arch/i386/stand/installboot/installboot.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'sys/arch/i386/stand') diff --git a/sys/arch/i386/stand/installboot/installboot.c b/sys/arch/i386/stand/installboot/installboot.c index fa9b0e1f069..bcb58623909 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.41 2003/08/25 23:27:43 tedu Exp $ */ +/* $OpenBSD: installboot.c,v 1.42 2004/01/20 23:02:26 tom Exp $ */ /* $NetBSD: installboot.c,v 1.5 1995/11/17 23:23:50 gwr Exp $ */ /* @@ -114,10 +114,14 @@ main(int argc, char *argv[]) switch (c) { case 'h': nheads = atoi(optarg); + if (nheads < 1 || nheads > 256) + errx(1, "invalid value for -h"); userspec = 1; break; case 's': nsectors = atoi(optarg); + if (nsectors < 1 || nsectors > 63) + errx(1, "invalid value for -s"); userspec = 1; break; case 'n': -- cgit v1.2.3