Fix array overflow on invalid macro arg evaluation

`macro_GetArg` had not been changed after the previous commit; however,
the old code relied on the `macroArgs->args` array being at least
`MAXMACROARGS` entries large (which was the case until the last commit).
The boundary against which it checked would have better been written as
`sizeof(macroArgs->args)/sizeof(macroArgs->args[0])`, I guess, but what's
done is done.
This commit is contained in:
ISSOtm
2020-05-12 16:43:59 +02:00
parent fee8a58b77
commit 80218fa109

View File

@@ -64,7 +64,8 @@ char const *macro_GetArg(uint32_t i)
{ {
uint32_t realIndex = i + macroArgs->shift - 1; uint32_t realIndex = i + macroArgs->shift - 1;
return realIndex >= MAXMACROARGS ? NULL : macroArgs->args[realIndex]; return realIndex >= macroArgs->nbArgs ? NULL
: macroArgs->args[realIndex];
} }
uint32_t macro_GetUniqueID(void) uint32_t macro_GetUniqueID(void)