summaryrefslogtreecommitdiffstats
path: root/fdisk/sfdisk.c
diff options
context:
space:
mode:
authorKarel Zak2006-12-07 00:25:58 +0100
committerKarel Zak2006-12-07 00:25:58 +0100
commit63cccae4684f83d2a462bc8abf24e51d1bd6efb6 (patch)
tree433db3f0b44e0f46e4130141f4a59db9c3564557 /fdisk/sfdisk.c
parentImported from util-linux-2.11r tarball. (diff)
downloadkernel-qcow2-util-linux-63cccae4684f83d2a462bc8abf24e51d1bd6efb6.tar.gz
kernel-qcow2-util-linux-63cccae4684f83d2a462bc8abf24e51d1bd6efb6.tar.xz
kernel-qcow2-util-linux-63cccae4684f83d2a462bc8abf24e51d1bd6efb6.zip
Imported from util-linux-2.11t tarball.
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r--fdisk/sfdisk.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index a35490283..52ebce52a 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1367,7 +1367,7 @@ extended_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z)
}
#define BSD_DISKMAGIC (0x82564557UL)
-#define BSD_MAXPARTITIONS 8
+#define BSD_MAXPARTITIONS 16
#define BSD_FS_UNUSED 0
typedef unsigned char u8;
typedef unsigned short u16;
@@ -1404,11 +1404,11 @@ bsd_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z) {
if (!(s = get_sector(dev,fd,start+1)))
return;
l = (struct bsd_disklabel *) (s->data);
- if (l->d_magic != BSD_DISKMAGIC)
+ if (l->d_magic != BSD_DISKMAGIC || l->d_magic2 != BSD_DISKMAGIC)
return;
bp = bp0 = &l->d_partitions[0];
- while (bp - bp0 <= BSD_MAXPARTITIONS) {
+ while (bp - bp0 < BSD_MAXPARTITIONS && bp - bp0 < l->d_npartitions) {
if (pno+1 >= SIZE(z->partitions)) {
printf(_("too many partitions - ignoring those "
"past nr (%d)\n"), pno-1);