summaryrefslogtreecommitdiff
path: root/sys/arch/mips64
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2006-10-21 20:10:40 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2006-10-21 20:10:40 +0000
commit028e50e88381ac41692fb30181b338f5b071050a (patch)
tree491f1da9c6fa9edfe3c7fb72f0ff3bf9df7d0823 /sys/arch/mips64
parent414b81d3b17102a765dc8117c456a89585a74d53 (diff)
Don't try to spoof 0 length DOS MBR/EBR partitions. By skipping
partitions with 0 in the length field we don't need to test for and skip partitions that are all zeros. Eliminating that code allows elimination of a local pointer. "0 length partitions are definately dead" deraadt@
Diffstat (limited to 'sys/arch/mips64')
-rw-r--r--sys/arch/mips64/mips64/disksubr.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/sys/arch/mips64/mips64/disksubr.c b/sys/arch/mips64/mips64/disksubr.c
index a941842d14d..5d75837567b 100644
--- a/sys/arch/mips64/mips64/disksubr.c
+++ b/sys/arch/mips64/mips64/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.31 2006/10/21 16:01:54 krw Exp $ */
+/* $OpenBSD: disksubr.c,v 1.32 2006/10/21 20:10:39 krw Exp $ */
/*
* Copyright (c) 1999 Michael Shalayeff
@@ -229,7 +229,7 @@ readdoslabel(bp, strat, lp, osdep, partoffp, cylp, spoofonly)
struct partition *pp;
unsigned long extoff = 0;
daddr_t part_blkno = DOSBBSECTOR;
- char *msg = NULL, *cp;
+ char *msg = NULL;
int dospartoff, cyl, i, ourpart = -1;
int wander = 1, n = 0, loop = 0;
@@ -314,25 +314,16 @@ donot:
continue;
if (letoh32(dp2->dp_size) > lp->d_secperunit)
continue;
- if (letoh32(dp2->dp_size))
- pp->p_size = letoh32(dp2->dp_size);
+ if (letoh32(dp2->dp_size) == 0)
+ continue;
if (letoh32(dp2->dp_start))
pp->p_offset =
letoh32(dp2->dp_start) + part_blkno;
+ pp->p_size = letoh32(dp2->dp_size);
+
switch (dp2->dp_typ) {
case DOSPTYP_UNUSED:
- for (cp = (char *)dp2;
- cp < (char *)(dp2 + 1); cp++)
- if (*cp)
- break;
- /*
- * Was it all zeroes? If so, it is
- * an unused entry that we don't
- * want to show.
- */
- if (cp == (char *)(dp2 + 1))
- continue;
pp->p_fstype = FS_UNUSED;
n++;
break;