Date: Sun, 3 Jun 2018 18:29:20 +0000 (UTC) From: Piotr Pawel Stefaniak <pstef@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334578 - head/usr.bin/indent Message-ID: <201806031829.w53ITKaa043167@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pstef Date: Sun Jun 3 18:29:20 2018 New Revision: 334578 URL: https://svnweb.freebsd.org/changeset/base/334578 Log: indent(1): don't overflow di_stack[] Modified: head/usr.bin/indent/indent.c Modified: head/usr.bin/indent/indent.c ============================================================================== --- head/usr.bin/indent/indent.c Sun Jun 3 18:19:48 2018 (r334577) +++ head/usr.bin/indent/indent.c Sun Jun 3 18:29:20 2018 (r334578) @@ -831,7 +831,12 @@ check_type: * with '{' */ if (ps.in_decl && ps.in_or_st) { /* this is either a structure * declaration or an init */ - di_stack[ps.dec_nest++] = dec_ind; + di_stack[ps.dec_nest] = dec_ind; + if (++ps.dec_nest == nitems(di_stack)) { + diag3(0, "Reached internal limit of %d struct levels", + nitems(di_stack)); + ps.dec_nest--; + } /* ? dec_ind = 0; */ } else {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806031829.w53ITKaa043167>