ivlpp: Ensure def_buf is allocated when calling macro_start_args()

macro_start_args() inserts a null string for arg 0 at the start of def_buf.
This allows macro_finish_arg() to calculate the length of the first actual
argument (arg 1). But macro_start_args() relied on def_buf having already
been allocated, which isn't the case when all the macros are pre-defined.

This fixes issue #1323.
This commit is contained in:
Martin Whitaker 2026-04-15 16:14:37 +01:00
parent 9b0d46b4bf
commit eed88fc61f
1 changed files with 4 additions and 4 deletions

View File

@ -1599,10 +1599,10 @@ static void macro_start_args(void)
* entry for arg 0. This will be used by macro_finish_arg() to
* calculate the buffer location for arg 1.
*/
if (def_buf) {
def_buf_free = def_buf_size - 1;
def_buf[0] = 0;
}
def_buf_grow_to_fit(1);
def_buf_free = def_buf_size - 1;
def_buf[0] = 0;
def_argo[0] = 0;
def_argl[0] = 0;
def_argc = 1;