summaryrefslogtreecommitdiff
path: root/cint_array.c
diff options
context:
space:
mode:
authorAndrew J. Schorr <aschorr@telemetry-investments.com>2020-01-14 09:26:31 -0500
committerAndrew J. Schorr <aschorr@telemetry-investments.com>2020-01-14 09:26:31 -0500
commit49125fbf794508efdb71a4f6f18a4bc324bd76ab (patch)
tree3fa3dbc0336f1cb48371a0de3fff10f2ab05889f /cint_array.c
parenta2a6e548bc3afcbf4c7401ebdfa8213dbe4e8dea (diff)
downloadgawk-49125fbf794508efdb71a4f6f18a4bc324bd76ab.tar.gz
Fix cint off-by-one array bounds overflow check for NHAT set in the environment.
Diffstat (limited to 'cint_array.c')
-rw-r--r--cint_array.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/cint_array.c b/cint_array.c
index 417f27d5..d7171ac8 100644
--- a/cint_array.c
+++ b/cint_array.c
@@ -175,7 +175,7 @@ cint_array_init(NODE *symbol ATTRIBUTE_UNUSED, NODE *subs ATTRIBUTE_UNUSED)
if ((newval = getenv_long("NHAT")) > 1 && newval < INT32_BIT)
NHAT = newval;
/* don't allow overflow off the end of the table */
- if (NHAT >= nelems)
+ if (NHAT > nelems - 2)
NHAT = nelems - 2;
THRESHOLD = power_two_table[NHAT + 1];
} else