From: Paul Smith Date: Sat, 5 Nov 2022 16:56:52 +0000 (-0400) Subject: [SV 63315] Allocate function names when defining functions X-Git-Tag: 4.4.0.90~47 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e80ce6fc90e1dc5da5c538167ac7ad719bb92b89;p=thirdparty%2Fmake.git [SV 63315] Allocate function names when defining functions * src/function.c (define_new_function): Don't keep a pointer to the user-provided name of a user-defined function: if the .so is unloaded it will point to garbage. Add the name to the strcache instead. --- diff --git a/src/function.c b/src/function.c index f0ef3434..e4a3af86 100644 --- a/src/function.c +++ b/src/function.c @@ -2801,7 +2801,7 @@ define_new_function (const floc *flocp, const char *name, _("Invalid maximum argument count (%u) for function %s"), max, name); ent = xmalloc (sizeof (struct function_table_entry)); - ent->name = name; + ent->name = strcache_add (name); ent->len = (unsigned char) len; ent->minimum_args = (unsigned char) min; ent->maximum_args = (unsigned char) max;