summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2012-02-02 08:42:46 +0000
committerotto <otto@openbsd.org>2012-02-02 08:42:46 +0000
commit51c6246adcef22b0000cf7cb73399a3aa0096ccd (patch)
treed587fbe2aa19c3af8f0057937265aafa8275bd58
parentAdd -l flag to send-keys to send input literally (without translating (diff)
downloadwireguard-openbsd-51c6246adcef22b0000cf7cb73399a3aa0096ccd.tar.xz
wireguard-openbsd-51c6246adcef22b0000cf7cb73399a3aa0096ccd.zip
bound chaeck table expansion; problem seen by Michael Niedermayer;
ok deraadt@ kili@
-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;
}