summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2022-11-05 12:56:52 -0400
committerPaul Smith <psmith@gnu.org>2022-11-13 10:39:48 -0500
commite80ce6fc90e1dc5da5c538167ac7ad719bb92b89 (patch)
tree9c0a9a33f3f370d6c512b94acfa43e5c7a44c2aa
parentd71c0bb0cefd7b38716eac2947bc34f3c750a8b4 (diff)
downloadmake-git-e80ce6fc90e1dc5da5c538167ac7ad719bb92b89.tar.gz
[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.
-rw-r--r--src/function.c2
1 files changed, 1 insertions, 1 deletions
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;