diff --git a/src/platform/linux.c b/src/platform/linux.c index 22e3245fcb..98edb78e5e 100644 --- a/src/platform/linux.c +++ b/src/platform/linux.c @@ -57,8 +57,8 @@ void platform_get_exe_path(utf8 *outPath) } int exeDelimiterIndex = (int)(exeDelimiter - exePath); + exePath[exeDelimiterIndex] = '\0'; safe_strncpy(outPath, exePath, exeDelimiterIndex + 1); - outPath[exeDelimiterIndex] = '\0'; } bool platform_check_steam_overlay_attached() { diff --git a/src/platform/posix.c b/src/platform/posix.c index 8a09b85b6f..36d9844c15 100644 --- a/src/platform/posix.c +++ b/src/platform/posix.c @@ -50,10 +50,6 @@ utf8 _openrctDataDirectoryPath[MAX_PATH] = { 0 }; */ int main(int argc, const char **argv) { - //RCT2_GLOBAL(RCT2_ADDRESS_HINSTANCE, HINSTANCE) = hInstance; - //RCT2_GLOBAL(RCT2_ADDRESS_CMDLINE, LPSTR) = lpCmdLine; - - STUB(); int run_game = cmdline_run(argv, argc); if (run_game == 1) { @@ -372,7 +368,7 @@ int platform_enumerate_directories_begin(const utf8 *directory) char *npattern = malloc(length+1); int converted; converted = wcstombs(npattern, wpattern, length); - npattern[length] = '\0'; + npattern[length - 1] = '\0'; if (converted == MAX_PATH) { log_warning("truncated string %s", npattern); } diff --git a/src/util/util.c b/src/util/util.c index 60b4a6ca6c..cfd0566eb7 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -205,7 +205,7 @@ char *safe_strncpy(char * destination, const char * source, size_t size) if (!terminated) { result[size - 1] = '\0'; - log_warning("Truncating string %s to %d bytes.", destination, size); + log_warning("Truncating string \"%s\" to %d bytes.", result, size); } return result; }