From 35c2bff255654ea2902e9b996e5711d755659967 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 8 Jan 1999 04:29:12 +0000 Subject: check for lp->d_secpercyl == 0) in bounds_check_with_label() --- sys/arch/kbus/kbus/disksubr.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'sys/arch/kbus') diff --git a/sys/arch/kbus/kbus/disksubr.c b/sys/arch/kbus/kbus/disksubr.c index b88ee680f00..52be09fc670 100644 --- a/sys/arch/kbus/kbus/disksubr.c +++ b/sys/arch/kbus/kbus/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.3 1998/10/03 21:18:55 millert Exp $ */ +/* $OpenBSD: disksubr.c,v 1.4 1999/01/08 04:29:06 millert Exp $ */ /* $NetBSD: disksubr.c,v 1.16 1996/04/28 20:25:59 thorpej Exp $ */ /* @@ -267,6 +267,12 @@ bounds_check_with_label(bp, lp, osdep, wlabel) struct partition *p = lp->d_partitions + DISKPART(bp->b_dev); int sz = howmany(bp->b_bcount, DEV_BSIZE); + /* avoid division by zero */ + if (lp->d_secpercyl == 0) { + bp->b_error = EINVAL; + goto bad; + } + /* overwriting disk label ? */ /* XXX should also protect bootstrap in first 8K */ /* XXX this assumes everything <=LABELSECTOR is label! */ -- cgit v1.2.3