diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-08-20 03:14:22 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2006-08-20 03:14:22 +0000 |
commit | 6390d7da0774617788a856170a04b6b2fd36ac96 (patch) | |
tree | 4da516253ee4708b2fd636fdb5286382a911ff2e /sys/arch/amd64 | |
parent | 2878160085960b88ce50f3bf1e3ad0b05bc43789 (diff) |
When spoofing an MSDOS disklabel, don't create partitions with a final
block past d_secperunit.
Fixes devices where bogus partitions with a starting offset >
d_secperunit were created. e.g. floppies formatted by Caldera DR-DOS.
ok pedro@
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/disksubr.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/disksubr.c b/sys/arch/amd64/amd64/disksubr.c index 6a614a1073d..4131dd5d64d 100644 --- a/sys/arch/amd64/amd64/disksubr.c +++ b/sys/arch/amd64/amd64/disksubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disksubr.c,v 1.11 2006/08/17 10:34:14 krw Exp $ */ +/* $OpenBSD: disksubr.c,v 1.12 2006/08/20 03:14:21 krw Exp $ */ /* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */ /* @@ -173,10 +173,13 @@ donot: */ for (dp2=dp, i=0; i < NDOSPART && n < 8; i++, dp2++) { struct partition *pp = &lp->d_partitions[8+n]; + u_int64_t blkno = (u_int64_t)part_blkno + + (u_int64_t)letoh32(dp2->dp_start) + + (u_int64_t)letoh32(dp2->dp_size); if (dp2->dp_typ == DOSPTYP_OPENBSD) continue; - if (letoh32(dp2->dp_size) > lp->d_secperunit) + if (blkno > lp->d_secperunit) continue; if (letoh32(dp2->dp_size)) pp->p_size = letoh32(dp2->dp_size); |