scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 158f03fe23f56bdfd5039cddce176d22f0278601
parent fd33aabb1f822618a90a1f05ad820f313fff0953
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  2 Jul 2012 11:27:10 +0200

Fixed bug in declarator function

Inner loop hadn't buffer overflow test. This patch adds the test,
trnsforming the for (ever) loop into a while.

Diffstat:
decl.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/decl.c b/decl.c @@ -102,19 +102,19 @@ static void declarator(void) register unsigned char *bp, *lim; lim = &qlf[NR_DECLARATORS]; - for (bp = qlf; yytoken == '*' && bp != lim; ++bp) { + for (bp = qlf; yytoken == '*' && bp != lim; next()) { *bp++ = PTR; - for (;;) { + while (bp != lim) { next(); switch (yytoken) { case CONST: case VOLATILE: case RESTRICT: *bp++ = yytoken; break; default: - goto next_pointer; + goto continue_outer; } } - next_pointer: ; + continue_outer: ; } if (bp == lim) error("Too much type declarators");