commit 283be1536196f042cb0161a6611baf9b3d8918dc
parent 08f54b63417d00eff3ca95469a436888add76741
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 18 May 2022 17:49:52 +0200
cc1: Allocate atleast one item for an arglist
This fixes a regression from commit 02f0aed96a08450b8f69e89fb784483e9e6af864 .
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cmd/cc/cc1/cpp.c b/src/cmd/cc/cc1/cpp.c
@@ -160,7 +160,7 @@ parsepars(Macro *mp)
next();
} else {
do {
- mp->arglist = xrealloc(mp->arglist, n*sizeof(char *));
+ mp->arglist = xrealloc(mp->arglist, (n+1)*sizeof(char *));
mp->arglist[n] = parameter(mp);
} while (++n < NR_MACROARG && yytoken == ',');
}