summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-01-26 20:41:56 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-01-26 20:41:56 +0000
commit6b4dba46dd554999806ae4409eeae7190c0f6b68 (patch)
tree823d8ee3c5f4c7cdbb4d46bb3f413f4c7fff2be1
parent31f1ba425870891e642182b728447f9a0fd4ecb3 (diff)
Fix for PR1643; constrain indices into "table" to be < table_size
so we don't go off and return random, unallocated bits.
-rw-r--r--usr.bin/less/position.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/less/position.c b/usr.bin/less/position.c
index 7778d0867a1..dcf1eb49c8b 100644
--- a/usr.bin/less/position.c
+++ b/usr.bin/less/position.c
@@ -56,6 +56,9 @@ extern int sc_width, sc_height;
position(where)
int where;
{
+ if (where >= table_size)
+ where = BOTTOM;
+
switch (where)
{
case BOTTOM: