From a33ac874c49ef018be9a1a0b82e5fbd3f2257da5 Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Thu, 2 Feb 2012 08:42:47 +0000 Subject: bound chaeck table expansion; problem seen by Michael Niedermayer; ok deraadt@ kili@ --- bin/ksh/table.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'bin/ksh') 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; } -- cgit v1.2.3