diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2013-09-08 12:47:05 +0200 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2013-09-08 12:47:05 +0200 |
commit | 4661f6cb95c365c434b753cdf6d4c1251f321230 (patch) | |
tree | cf1225ec147958393063ad3bb6b3995abecf98a9 /cint_array.c | |
parent | 187f81febdf5a52d1c646bd83a10c9f03d13947b (diff) | |
parent | c3e4d0cf3f1fd24164e0a58db23b86b56c6dc7c8 (diff) | |
download | egawk-4661f6cb95c365c434b753cdf6d4c1251f321230.tar.gz egawk-4661f6cb95c365c434b753cdf6d4c1251f321230.tar.bz2 egawk-4661f6cb95c365c434b753cdf6d4c1251f321230.zip |
Merge branch 'gawk-4.1-stable'
Diffstat (limited to 'cint_array.c')
-rw-r--r-- | cint_array.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/cint_array.c b/cint_array.c index 1d34c2f7..3945e6e7 100644 --- a/cint_array.c +++ b/cint_array.c @@ -150,10 +150,14 @@ cint_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED) { if (symbol == NULL) { long newval; + size_t nelems = (sizeof(power_two_table) / sizeof(power_two_table[0])); /* check relevant environment variables */ if ((newval = getenv_long("NHAT")) > 1 && newval < INT32_BIT) NHAT = newval; + /* don't allow overflow off the end of the table */ + if (NHAT >= nelems) + NHAT = nelems - 2; THRESHOLD = power_two_table[NHAT + 1]; } else null_array(symbol); |