aboutsummaryrefslogtreecommitdiff
path: root/sbin/bsdlabel/bsdlabel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/bsdlabel/bsdlabel.c')
-rw-r--r--sbin/bsdlabel/bsdlabel.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index cef20506fd22..8d44e6878df0 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.c
@@ -477,6 +477,9 @@ readlabel(int flag)
(ioctl(f, DIOCGSECTORSIZE, &secsize) != 0)) {
err(4, "cannot get disk geometry");
}
+ if (mediasize > (off_t)0xffffffff * secsize)
+ errx(1,
+ "disks with more than 2^32-1 sectors are not supported");
(void)lseek(f, (off_t)0, SEEK_SET);
if (read(f, bootarea, BBSIZE) != BBSIZE)
err(4, "%s read", specname);