ref: 283be1536196f042cb0161a6611baf9b3d8918dc
parent: 08f54b63417d00eff3ca95469a436888add76741
author: Hiltjo Posthuma <hiltjo@codemadness.org>
date: Wed May 18 13:49:52 EDT 2022
cc1: Allocate atleast one item for an arglist This fixes a regression from commit 02f0aed96a08450b8f69e89fb784483e9e6af864 .
--- a/src/cmd/cc/cc1/cpp.c
+++ b/src/cmd/cc/cc1/cpp.c
@@ -160,7 +160,7 @@
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 == ',');
}