summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1998-11-21 20:43:42 +0000
committerderaadt <deraadt@openbsd.org>1998-11-21 20:43:42 +0000
commitc13fcfdf49ac6b7b2c5f918e74b8a6d1bc2bc06f (patch)
tree3c2ceaf1bd6a0a1e183d769464b45500f1efc346
parentwhen mmap'ing check for offset >= size, not just > size and disallow negative offsets; mrg@netbsd.org (diff)
downloadwireguard-openbsd-c13fcfdf49ac6b7b2c5f918e74b8a6d1bc2bc06f.tar.xz
wireguard-openbsd-c13fcfdf49ac6b7b2c5f918e74b8a6d1bc2bc06f.zip
deal with d_secpercyl insanity
-rw-r--r--sys/arch/alpha/alpha/disksubr.c6
-rw-r--r--sys/arch/i386/i386/disksubr.c6
-rw-r--r--sys/arch/mips/mips/disksubr.c6
3 files changed, 15 insertions, 3 deletions
diff --git a/sys/arch/alpha/alpha/disksubr.c b/sys/arch/alpha/alpha/disksubr.c
index 2031a7b70c3..d3aad8078e2 100644
--- a/sys/arch/alpha/alpha/disksubr.c
+++ b/sys/arch/alpha/alpha/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.23 1998/10/03 21:18:54 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.24 1998/11/21 20:43:42 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -246,6 +246,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0) {
+ msg = "invalid geometry";
+ goto done;
+ }
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < RAW_PART; i++) {
lp->d_partitions[i].p_size = 0;
diff --git a/sys/arch/i386/i386/disksubr.c b/sys/arch/i386/i386/disksubr.c
index 128dead0b9c..7d99c2193f1 100644
--- a/sys/arch/i386/i386/disksubr.c
+++ b/sys/arch/i386/i386/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.34 1998/10/03 21:18:54 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.35 1998/11/21 20:43:43 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -91,6 +91,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
/* minimal requirements for archtypal disk label */
if (lp->d_secsize == 0)
lp->d_secsize = DEV_BSIZE;
+ if (lp->d_secpercyl == 0) {
+ msg = "invalid geometry";
+ goto done;
+ }
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
lp->d_npartitions = RAW_PART + 1;
diff --git a/sys/arch/mips/mips/disksubr.c b/sys/arch/mips/mips/disksubr.c
index a3a748829ce..36aee7976bc 100644
--- a/sys/arch/mips/mips/disksubr.c
+++ b/sys/arch/mips/mips/disksubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: disksubr.c,v 1.6 1998/10/03 21:18:55 millert Exp $ */
+/* $OpenBSD: disksubr.c,v 1.7 1998/11/21 20:43:44 deraadt Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1996/05/03 19:42:03 christos Exp $ */
/*
@@ -96,6 +96,10 @@ readdisklabel(dev, strat, lp, osdep, spoofonly)
lp->d_secsize = DEV_BSIZE;
if (lp->d_secperunit == 0)
lp->d_secperunit = 0x1fffffff;
+ if (lp->d_secpercyl == 0) {
+ msg = "invalid geometry";
+ goto done;
+ }
lp->d_npartitions = RAW_PART + 1;
for (i = 0; i < RAW_PART; i++) {
lp->d_partitions[i].p_size = 0;