summaryrefslogtreecommitdiffhomepage
path: root/lib.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-04-26 11:33:11 +0200
committerJo-Philipp Wich <jo@mein.io>2021-04-26 11:33:11 +0200
commit4cf897c200e72ba5d8823af3fcd515ac92651b99 (patch)
tree01c9a9bd7b4ff3964a84cec119054a6692397a53 /lib.c
parent35af4ba4fc21a4b2357c50e6b02a2e3e4b236e88 (diff)
lib: uc_system(): fix invalid free() of non-heap memory
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'lib.c')
-rw-r--r--lib.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib.c b/lib.c
index f4e69c7..5733646 100644
--- a/lib.c
+++ b/lib.c
@@ -2127,9 +2127,9 @@ uc_system(uc_vm *vm, size_t nargs)
switch (ucv_type(cmdline)) {
case UC_STRING:
arglist = xalloc(sizeof(*arglist) * 4);
- arglist[0] = "/bin/sh";
- arglist[1] = "-c";
- arglist[2] = ucv_string_get(cmdline);
+ arglist[0] = xstrdup("/bin/sh");
+ arglist[1] = xstrdup("-c");
+ arglist[2] = ucv_to_string(vm, cmdline);
arglist[3] = NULL;
break;