scc

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

commit 1cdf7496909e5ec1532ad2fb1903c86f19f57ca6
parent 8de17d48a084c79889db0be5bf68da22d65584e8
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat,  4 Jun 2016 12:59:31 +0200

[driver] modify argument number check in addarg()

We only need to reserve args[0]: argv0 and args[NARGS - 1]: NULL

Diffstat:
driver/posix/scc.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -140,7 +140,7 @@ static void addarg(int tool, char *arg) { struct tool *t = &tools[tool]; - if (t->nargs >= NARGS - 3) /* 3: argv0, filename, NULL terminator */ + if (!(t->nargs < NARGS - 2)) /* 2: argv0, NULL terminator */ die("scc: too many parameters given"); t->args[++t->nargs] = arg;