aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/yacc.c
diff options
context:
space:
mode:
authorNeven Sajko <nsajko@gmail.com>2019-08-22 11:28:53 +0000
committerRuss Cox <rsc@golang.org>2020-01-13 14:41:28 -0500
commit4a3f20bceee7cef125f9a88bab32439f9fe4f773 (patch)
treebdb86244423e5a97457d006b69f27000551c97ae /src/cmd/yacc.c
parent7ba9f9467d95fa8d05bb04d36fd4c602e497f529 (diff)
downloadplan9port-4a3f20bceee7cef125f9a88bab32439f9fe4f773.tar.gz
plan9port-4a3f20bceee7cef125f9a88bab32439f9fe4f773.tar.bz2
plan9port-4a3f20bceee7cef125f9a88bab32439f9fe4f773.zip
cmd/yacc: do not create an out of bounds pointer
An out of bounds pointer/array index being created is an error in standard C. Updates #313 Change-Id: I7108fcde1a8e03017e9ab852adb737940489c827
Diffstat (limited to 'src/cmd/yacc.c')
-rw-r--r--src/cmd/yacc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cmd/yacc.c b/src/cmd/yacc.c
index 32990f62..5db36d04 100644
--- a/src/cmd/yacc.c
+++ b/src/cmd/yacc.c
@@ -2819,8 +2819,9 @@ stin(int i)
for(n = -maxoff; n < ACTSIZE; n++) {
flag = 0;
for(r = q1; r < q2; r += 2) {
- if((s = *r + n + amem) < amem)
+ if(*r + n < 0)
goto nextn;
+ s = *r + n + amem;
if(*s == 0)
flag++;
else