From: deraadt Date: Fri, 18 Apr 1997 20:15:43 +0000 (+0000) Subject: do not check BOOT_MAGIC! X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=53349cfe754168381f42dbaab8bfb36e9e891a1f;p=openbsd do not check BOOT_MAGIC! --- diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c index 117c8b173c5..bab95107c7b 100644 --- a/sys/arch/arc/arc/disksubr.c +++ b/sys/arch/arc/arc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.11 1997/04/18 14:27:23 provos Exp $ */ +/* $OpenBSD: disksubr.c,v 1.12 1997/04/18 20:15:47 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -112,7 +112,6 @@ readdisklabel(dev, strat, lp, osdep) unsigned long extoff = 0; int wander = 1; int n = 0; - unsigned char *p; /* * Read dos partition table, follow extended partitions. @@ -135,12 +134,11 @@ readdisklabel(dev, strat, lp, osdep) goto done; } - /* XXX - how do we check veracity/bounds of this? */ - p = (unsigned char *)bp->b_data + BOOT_MAGIC_OFF; - if ((p[0] | (p[1] << 8)) != BOOT_MAGIC) { - msg = "dos partition corrupt"; - goto done; - } + /* + * We would like to check if each MBR has a valid + * BOOT_MAGIC, but we cannot because it doesn't + * always exist. So.. we assume the MBR is valid. + */ bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp)); diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index aae89dbe007..f94a3927d0c 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.20 1997/04/18 14:27:22 provos Exp $ */ +/* $OpenBSD: disksubr.c,v 1.21 1997/04/18 20:15:43 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -112,7 +112,6 @@ readdisklabel(dev, strat, lp, osdep) unsigned long extoff = 0; int wander = 1; int n = 0; - unsigned char *p; /* * Read dos partition table, follow extended partitions. @@ -135,12 +134,11 @@ readdisklabel(dev, strat, lp, osdep) goto done; } - /* XXX - how do we check veracity/bounds of this? */ - p = (unsigned char *)bp->b_data + BOOT_MAGIC_OFF; - if ((p[0] | (p[1] << 8)) != BOOT_MAGIC) { - msg = "dos partition corrupt"; - goto done; - } + /* + * We would like to check if each MBR has a valid + * BOOT_MAGIC, but we cannot because it doesn't + * always exist. So.. we assume the MBR is valid. + */ bcopy(bp->b_data + DOSPARTOFF, dp, NDOSPART * sizeof(*dp));