summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>1999-02-17 13:15:47 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>1999-02-17 13:15:47 +0000
commit3db44f2b81f64fb042024e8eaa04a8e5efba9589 (patch)
tree6c979a926e7ac12d373617c7dbd2486646eaac08
parent345de88c5eb7dbc08e8951178152a6e64680ab47 (diff)
Always check that the start of our candidate region is within the
bounds of "substart" and "subend".
-rw-r--r--sys/kern/subr_extent.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/subr_extent.c b/sys/kern/subr_extent.c
index c5a2f94176b..5333ede58a1 100644
--- a/sys/kern/subr_extent.c
+++ b/sys/kern/subr_extent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_extent.c,v 1.6 1999/01/11 01:28:10 niklas Exp $ */
+/* $OpenBSD: subr_extent.c,v 1.7 1999/02/17 13:15:46 fgsch Exp $ */
/* $NetBSD: subr_extent.c,v 1.7 1996/11/21 18:46:34 cgd Exp $ */
/*-
@@ -640,6 +640,13 @@ extent_alloc_subregion(ex, substart, subend, size, alignment, boundary,
for (; rp != NULL; rp = rp->er_link.le_next) {
/*
+ * Check from the current starting point to the
+ * end of the subregion.
+ */
+ if (LE_OV(newstart, size, subend) == 0)
+ goto fail;
+
+ /*
* Check the chunk before "rp". Note that our
* comparison is safe from overflow conditions.
*/