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
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"