From c70e8ed167b9f5ec7bda4b0ae85b994e50ed98ba Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 18 May 2022 21:59:08 -0400 Subject: [PATCH] vere: copy argv[0] before calling dirname() --- pkg/urbit/daemon/main.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/urbit/daemon/main.c b/pkg/urbit/daemon/main.c index b9adf35cc..6121db083 100644 --- a/pkg/urbit/daemon/main.c +++ b/pkg/urbit/daemon/main.c @@ -361,7 +361,9 @@ _main_getopt(c3_i argc, c3_c** argv) if ( (U3_BIN_ALIAS_LEN <= len_w) && (0 == strcmp(argv[0] + (len_w - U3_BIN_ALIAS_LEN), U3_BIN_ALIAS)) ) { - u3_Host.dir_c = _main_repath(dirname(argv[0])); + c3_c* bin_c = strdup(argv[0]); + u3_Host.dir_c = _main_repath(dirname(bin_c)); + c3_free(bin_c); } // no args, invalid command //