diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-01-24 11:17:13 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-01-24 11:17:13 +0000 |
commit | fb6e8e5aabc54cd8b8d7c5de9a33fee7f0aede4b (patch) | |
tree | 0aadfb3b4d6129d0f10d0e77cd53b4e3dca5fb52 /sys | |
parent | a6312a5e9c444d5a1477765256dda109eef69da3 (diff) |
do not build fake disklabel partitions for MBR partitions that have out-of-range start/size fields
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arc/arc/disksubr.c | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/disksubr.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sys/arch/arc/arc/disksubr.c b/sys/arch/arc/arc/disksubr.c index 034f63be1f0..6472fe44dd1 100644 --- a/sys/arch/arc/arc/disksubr.c +++ b/sys/arch/arc/arc/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.7 1997/01/14 00:46:42 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.8 1997/01/24 11:17:12 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -161,6 +161,8 @@ readdisklabel(dev, strat, lp, osdep) * a fake label in which m/n/o/p are MBR partitions 0/1/2/3 */ for (dp2=dp, i=0; i < NDOSPART; i++, dp2++) { + if (dp2->dp_start + dp2->dp_size > lp->d_nsectors) + continue; lp->d_partitions[12+i].p_size = dp2->dp_size; lp->d_partitions[12+i].p_offset = dp2->dp_start; for (ip = fat_types; *ip != -1; ip++) { diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c index 26cfdd13c28..9064e1f44be 100644 --- a/sys/arch/i386/i386/disksubr.c +++ b/sys/arch/i386/i386/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.16 1997/01/14 00:46:45 deraadt Exp $ */ +/* $OpenBSD: disksubr.c,v 1.17 1997/01/24 11:17:09 deraadt Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -161,6 +161,8 @@ readdisklabel(dev, strat, lp, osdep) * a fake label in which m/n/o/p are MBR partitions 0/1/2/3 */ for (dp2=dp, i=0; i < NDOSPART; i++, dp2++) { + if (dp2->dp_start + dp2->dp_size > lp->d_nsectors) + continue; lp->d_partitions[12+i].p_size = dp2->dp_size; lp->d_partitions[12+i].p_offset = dp2->dp_start; for (ip = fat_types; *ip != -1; ip++) { |