svn commit: r310863 - head/usr.bin/indent
Piotr Pawel Stefaniak
pstef at FreeBSD.org
Fri Dec 30 21:00:46 UTC 2016
Author: pstef
Date: Fri Dec 30 21:00:45 2016
New Revision: 310863
URL: https://svnweb.freebsd.org/changeset/base/310863
Log:
indent(1): Avoid out of bounds access of array ps.paren_indents
ps.p_l_follow can't be allowed to grow beyond maximum index of paren_indents.
Approved by: pfg (mentor)
Modified:
head/usr.bin/indent/indent.c
Modified: head/usr.bin/indent/indent.c
==============================================================================
--- head/usr.bin/indent/indent.c Fri Dec 30 20:48:22 2016 (r310862)
+++ head/usr.bin/indent/indent.c Fri Dec 30 21:00:45 2016 (r310863)
@@ -525,7 +525,12 @@ check_type:
break;
case lparen: /* got a '(' or '[' */
- ++ps.p_l_follow; /* count parens to make Healy happy */
+ /* count parens to make Healy happy */
+ if (++ps.p_l_follow == nitems(ps.paren_indents)) {
+ diag3(0, "Reached internal limit of %d unclosed parens",
+ nitems(ps.paren_indents));
+ ps.p_l_follow--;
+ }
if (ps.want_blank && *token != '[' &&
(ps.last_token != ident || proc_calls_space ||
/* offsetof (1) is never allowed a space; sizeof (2) gets
More information about the svn-src-all
mailing list