diff --git a/src/testlo.c b/src/testlo.c index 55cb49e..ad0ea36 100644 --- a/src/testlo.c +++ b/src/testlo.c @@ -1450,12 +1450,13 @@ void test_subtest(lo_server_thread st) #ifdef WIN32 { - char cwd[2048]; + char cwd[MAX_PATH]; // Calculate path to subtest.exe GetModuleFileName(NULL, cwd, MAX_PATH); - char *lastBackslash = strrchr(cwd, '\\'); + const char* pathdelim_str = PATHDELIM; + char *lastBackslash = strrchr(cwd, *pathdelim_str); *lastBackslash = 0; // Null-terminate at the last backslash to get the directory - snprintf(cmd, 2048, "%s" PATHDELIM "subtest" EXTEXE, cwd); + snprintf(cmd, sizeof(cmd), "%s" PATHDELIM "subtest" EXTEXE, cwd); } printf("spawning subtest with `%s'\n", cmd); for (i=0; i<2; i++) {