From c87e4538b8388da20738f69943ab2a3ba1eeb611 Mon Sep 17 00:00:00 2001 From: Marius Petcu Date: Thu, 26 Sep 2019 09:47:12 +0300 Subject: [PATCH] Fix get_bundle_root() on Linux --- defos/src/defos_linux.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/defos/src/defos_linux.cpp b/defos/src/defos_linux.cpp index 8dfaad9..4c5b8c2 100644 --- a/defos/src/defos_linux.cpp +++ b/defos/src/defos_linux.cpp @@ -826,6 +826,7 @@ char* defos_get_bundle_root() char* path = (char*)malloc(PATH_MAX + 2); ssize_t ret = readlink("/proc/self/exe", path, PATH_MAX + 2); if (ret >= 0 && ret <= PATH_MAX + 1) { + path[ret] = '\0'; result = copy_string(dirname(path)); } else { const char* path2 = (const char*)getauxval(AT_EXECFN);