diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-29 17:34:09 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2016-01-29 17:34:09 +0000 |
commit | b06e7fd87f95fccc8d1bb69e2229957181188c3c (patch) | |
tree | 75ad89b281ac27f82c11712ae6f39727e8dd8adc /sbin/pdisk | |
parent | 9000180d241007b094bbf2cbd58e127a9a852e6d (diff) |
Warn of partitions extending past the end of the media.
Diffstat (limited to 'sbin/pdisk')
-rw-r--r-- | sbin/pdisk/partition_map.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sbin/pdisk/partition_map.c b/sbin/pdisk/partition_map.c index e683f90e0c7..47d1bffb1e4 100644 --- a/sbin/pdisk/partition_map.c +++ b/sbin/pdisk/partition_map.c @@ -1,4 +1,4 @@ -/* $OpenBSD: partition_map.c,v 1.85 2016/01/29 15:06:37 krw Exp $ */ +/* $OpenBSD: partition_map.c,v 1.86 2016/01/29 17:34:08 krw Exp $ */ /* * partition_map.c - partition map routines @@ -223,6 +223,12 @@ read_partition_map(struct partition_map *map) LIST_FOREACH(cur, &map->base_order, base_entry) { base = cur->dpme->dpme_pblock_start; next = base + cur->dpme->dpme_pblocks; + if (base >= map->media_size || + next < base || + next > map->media_size) { + warnx("Partition extends past end of disk: %u -> %u", + base, next); + } nextcur = LIST_NEXT(cur, base_entry); if (nextcur) nextbase = nextcur->dpme->dpme_pblock_start; |