summaryrefslogtreecommitdiff
path: root/src/main_windows.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-04 20:49:02 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-04 20:49:02 +0100
commit305b9dd7c40abf1e8936937e539f7565423183da (patch)
treebf20e903e44ba26fee58fd804b71ea7b4b769f1e /src/main_windows.cpp
parentd515025b35b1d0fdbc0e1df74a0dffd06a9cc954 (diff)
size check everywhere
Diffstat (limited to 'src/main_windows.cpp')
-rw-r--r--src/main_windows.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main_windows.cpp b/src/main_windows.cpp
index 5f6e1e9..45963d1 100644
--- a/src/main_windows.cpp
+++ b/src/main_windows.cpp
@@ -266,7 +266,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir)
MultiByteToWideChar(CP_UTF8, 0, result->directory_to_search, -1, search_dir, MAX_INPUT_LENGTH);
}
else {
- wcscpy(search_dir, start_dir);
+ wcscpy_s(search_dir, MAX_INPUT_LENGTH, start_dir);
}
// Append wildcard
@@ -300,9 +300,9 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir)
continue;
wchar_t* subdir_buffer_path = (wchar_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH);
- wcscpy(subdir_buffer_path, search_dir);
- wcscat(subdir_buffer_path, L"\\");
- wcscat(subdir_buffer_path, name);
+ wcscpy_s(subdir_buffer_path, MAX_INPUT_LENGTH, search_dir);
+ wcscat_s(subdir_buffer_path, MAX_INPUT_LENGTH, L"\\");
+ wcscat_s(subdir_buffer_path, MAX_INPUT_LENGTH, name);
ts_platform_list_files_block(result, subdir_buffer_path);
}
else if ((file_info.dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED) ||
@@ -321,9 +321,9 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir)
(void)matched_filter;
wchar_t complete_file_path[MAX_INPUT_LENGTH];
- wcscpy(complete_file_path, search_dir);
- wcscat(complete_file_path, L"\\");
- wcscat(complete_file_path, name);
+ wcscpy_s(complete_file_path, MAX_INPUT_LENGTH, search_dir);
+ wcscat_s(complete_file_path, MAX_INPUT_LENGTH, L"\\");
+ wcscat_s(complete_file_path, MAX_INPUT_LENGTH, name);
ts_found_file* f = (ts_found_file*)ts_memory_bucket_reserve(&result->memory, sizeof(ts_found_file));
f->path = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH);