diff --git a/LibOS/shim/include/shim_utils.h b/LibOS/shim/include/shim_utils.h index 23e034d7..93494080 100644 --- a/LibOS/shim/include/shim_utils.h +++ b/LibOS/shim/include/shim_utils.h @@ -145,19 +145,6 @@ void* malloc(size_t size); void free(void* mem); void* malloc_copy(const void* mem, size_t size); -static inline __attribute__((always_inline)) char* qstrtostr(struct shim_qstr* qstr, bool on_stack) { - int len = qstr->len; - char* buf = on_stack ? __alloca(len + 1) : malloc(len + 1); - - if (!buf) - return NULL; - - memcpy(buf, qstrgetstr(qstr), len); - - buf[len] = 0; - return buf; -} - /* typedef a 32 bit type */ #ifndef UINT4 #define UINT4 uint32_t diff --git a/LibOS/shim/src/ipc/shim_ipc_ranges.c b/LibOS/shim/src/ipc/shim_ipc_ranges.c index df92cab4..a7f26c24 100644 --- a/LibOS/shim/src/ipc/shim_ipc_ranges.c +++ b/LibOS/shim/src/ipc/shim_ipc_ranges.c @@ -1504,8 +1504,13 @@ retry: if (!p->port) { IDTYPE type = IPC_PORT_OWNER | IPC_PORT_LISTEN; IDTYPE owner = p->vmid; - char* uri = qstrtostr(&p->uri, true); struct shim_ipc_port* port = NULL; + size_t uri_len = p->uri.len; + char uri[uri_len + 1]; + + memcpy(&uri, qstrgetstr(&p->uri), uri_len); + uri[uri_len] = 0; + unlock(&range_map_lock); PAL_HANDLE pal_handle = DkStreamOpen(uri, 0, 0, 0, 0);