svn commit: r309419 - head/usr.bin/indent
Pedro F. Giffuni
pfg at FreeBSD.org
Fri Dec 2 16:42:46 UTC 2016
Author: pfg
Date: Fri Dec 2 16:42:45 2016
New Revision: 309419
URL: https://svnweb.freebsd.org/changeset/base/309419
Log:
indent(1): Avoid out-of-bound accesses of array ps.p_stack.
Submitted by: Piotr Stefaniak
Modified:
head/usr.bin/indent/parse.c
Modified: head/usr.bin/indent/parse.c
==============================================================================
--- head/usr.bin/indent/parse.c Fri Dec 2 16:41:08 2016 (r309418)
+++ head/usr.bin/indent/parse.c Fri Dec 2 16:42:45 2016 (r309419)
@@ -172,7 +172,7 @@ parse(int tk) /* tk: the code for the co
case rbrace: /* scanned a } */
/* stack should have <lbrace> <stmt> or <lbrace> <stmtl> */
- if (ps.p_stack[ps.tos - 1] == lbrace) {
+ if (ps.tos > 0 && ps.p_stack[ps.tos - 1] == lbrace) {
ps.ind_level = ps.i_l_follow = ps.il[--ps.tos];
ps.p_stack[ps.tos] = stmt;
}
More information about the svn-src-all
mailing list