summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/eina/eina_test_file.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 0ed1c93d75..bcaff19e40 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -490,7 +490,29 @@ static void *
490_eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED) 490_eina_test_file_thread(void *data EINA_UNUSED, Eina_Thread t EINA_UNUSED)
491{ 491{
492#ifdef _WIN32 492#ifdef _WIN32
493 const char *filename = "cmd.exe"; 493 char filename[MAX_PATH];
494 size_t len;
495 const char test_file[] = "cmd.exe";
496
497 fail_if(!GetSystemDirectoryA(filename, MAX_PATH));
498
499 len = strlen(filename);
500
501 /*
502 * Check the buffer size.
503 * The system path length + path separator + length of the test_file + null terminator
504 * Must fit in MAX_PATH.
505 */
506 fail_if(MAX_PATH < len + 1 + sizeof(test_file));
507
508 // append trailing directory separator if there isn't one
509 if (filename[len - 1] != '\\' && filename[len - 1] != '/')
510 {
511 filename[len] = '\\';
512 filename[len + 1] = '\0';
513 }
514
515 strncat(filename, test_file, MAX_PATH - len - 2);
494#else 516#else
495 const char *filename = "/bin/sh"; 517 const char *filename = "/bin/sh";
496#endif 518#endif