aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
Diffstat (limited to 'asm')
-rw-r--r--asm/preproc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index a3f8b7de..c8d86656 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -5138,7 +5138,6 @@ static MMacro *is_mmacro(Token * tline, int *nparamp, Token ***params_array)
memcpy(&params[nparam+1], &m->defaults[nparam+1-m->nparam_min],
(newnparam - nparam) * sizeof(*params));
nparam = newnparam;
- params[nparam+1] = NULL;
}
/*
* If we've gone over the maximum parameter count (and
@@ -5148,6 +5147,12 @@ static MMacro *is_mmacro(Token * tline, int *nparamp, Token ***params_array)
if (m->plus && nparam > m->nparam_max)
nparam = m->nparam_max;
+ /*
+ * If nparam was adjusted above, make sure the list is still
+ * NULL-terminated.
+ */
+ params[nparam+1] = NULL;
+
/* Done! */
*params_array = params;
*nparamp = nparam;