tcmd/yacc: do not create an out of bounds pointer - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit 4a3f20bceee7cef125f9a88bab32439f9fe4f773 (DIR) parent 7ba9f9467d95fa8d05bb04d36fd4c602e497f529 (HTM) Author: Neven Sajko <nsajko@gmail.com> Date: Thu, 22 Aug 2019 11:28:53 +0000 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: M src/cmd/yacc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- (DIR) diff --git a/src/cmd/yacc.c b/src/cmd/yacc.c t@@ -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