summaryrefslogtreecommitdiff
path: root/sys/arch/hppa64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-08-20 03:14:22 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-08-20 03:14:22 +0000
commit6390d7da0774617788a856170a04b6b2fd36ac96 (patch)
tree4da516253ee4708b2fd636fdb5286382a911ff2e /sys/arch/hppa64
parent2878160085960b88ce50f3bf1e3ad0b05bc43789 (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/hppa64')
-rw-r--r--sys/arch/hppa64/hppa64/disksubr.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/hppa64/hppa64/disksubr.c b/sys/arch/hppa64/hppa64/disksubr.c
index 88aa5bdf588..937a610adc0 100644
--- a/sys/arch/hppa64/hppa64/disksubr.c
+++ b/sys/arch/hppa64/hppa64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.14 2006/08/18 00:39:17 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.15 2006/08/20 03:14:21 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -315,10 +315,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);