summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2012-02-02 08:42:47 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2012-02-02 08:42:47 +0000
commita33ac874c49ef018be9a1a0b82e5fbd3f2257da5 (patch)
tree1502b8c37a5659278b874dbd269a8772cacb27d1 /bin
parentf4ecfe0090d766222255d9d8d42b2f083c4700ff (diff)
bound chaeck table expansion; problem seen by Michael Niedermayer;
ok deraadt@ kili@
Diffstat (limited to 'bin')
-rw-r--r--bin/ksh/table.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/ksh/table.c b/bin/ksh/table.c
index 5f052c9bafc..cedc15f2807 100644
--- a/bin/ksh/table.c
+++ b/bin/ksh/table.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: table.c,v 1.13 2009/01/17 22:06:44 millert Exp $ */
+/* $OpenBSD: table.c,v 1.14 2012/02/02 08:42:46 otto Exp $ */
/*
* dynamic hashed associative table for commands and variables
@@ -108,7 +108,10 @@ ktenter(struct table *tp, const char *n, unsigned int h)
}
if (tp->nfree <= 0) { /* too full */
- texpand(tp, 2*tp->size);
+ if (tp->size <= SHRT_MAX/2)
+ texpand(tp, 2*tp->size);
+ else
+ internal_errorf(1, "too many vars");
goto Search;
}