diff options
| author | tsutsui <tsutsui@NetBSD.org> | 2015-07-17 20:30:21 +0000 |
|---|---|---|
| committer | tsutsui <tsutsui@NetBSD.org> | 2015-07-17 20:30:21 +0000 |
| commit | 6a5eaf58293348bd5347cb385fdecf1f1543e311 (patch) | |
| tree | 50c461e1b86f021d9974cac5db864ad178edc8b8 /sbin/disklabel | |
| parent | 9e1e199a849fe270e3971a785dc514f31160709d (diff) | |
Fix botch in "make disklabel a MI tool" changes in rev 1.2.
After that chanage, "MAXPARTITIONS" constant is not for the target port.
If host's MAXPARTITIONS is larger than a value of the target label and
target endianness is different from the build host, bswaplabel() could
overwrite data beyond the disklabel and primary boot stored after
LABELSECTOR in images might be corrupted.
This fixes boot failure of sun2 liveimage built by
"build.sh -U -m sun2 release live-image"
on TME.
Should be pulled up to netbsd-7.
Diffstat (limited to 'sbin/disklabel')
| -rw-r--r-- | sbin/disklabel/bswap.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/disklabel/bswap.c b/sbin/disklabel/bswap.c index 3b5a1c277b6..585beb5462d 100644 --- a/sbin/disklabel/bswap.c +++ b/sbin/disklabel/bswap.c @@ -1,4 +1,4 @@ -/* $NetBSD: bswap.c,v 1.2 2013/05/03 16:05:12 matt Exp $ */ +/* $NetBSD: bswap.c,v 1.3 2015/07/17 20:30:21 tsutsui Exp $ */ /*- * Copyright (c) 2009 Izumi Tsutsui. All rights reserved. @@ -120,7 +120,7 @@ bswaplabel(struct disklabel *nlp, const struct disklabel *olp) nlp->d_bbsize = bswap32(olp->d_bbsize); nlp->d_sbsize = bswap32(olp->d_sbsize); - for (i = 0; i < MAXPARTITIONS; i++) { + for (i = 0; i < maxpartitions; i++) { nlp->d_partitions[i].p_size = bswap32(olp->d_partitions[i].p_size); nlp->d_partitions[i].p_offset = |
