diff options
author | Neven Sajko <nsajko@gmail.com> | 2019-08-22 11:28:53 +0000 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2020-01-13 14:41:28 -0500 |
commit | 4a3f20bceee7cef125f9a88bab32439f9fe4f773 (patch) | |
tree | bdb86244423e5a97457d006b69f27000551c97ae /src | |
parent | 7ba9f9467d95fa8d05bb04d36fd4c602e497f529 (diff) | |
download | plan9port-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')
-rw-r--r-- | src/cmd/yacc.c | 3 |
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 |