diff options
| author | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-12 18:59:13 +0100 |
|---|---|---|
| committer | Aldrik Ramaekers <aldrikboy@gmail.com> | 2024-03-12 18:59:13 +0100 |
| commit | fe179ae0cb8fbce1cf86521e744c384553e515f2 (patch) | |
| tree | 2bdc0c07c7ad08c7bb4e06dc33ef1c8803fc0e5a | |
| parent | 2bd955903676822f6308516bdcb13cb0886fa0ef (diff) | |
fix stackoverflow in deep searches
| -rw-r--r-- | src/unix/main_unix.cpp | 4 | ||||
| -rw-r--r-- | src/windows/main_windows.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/unix/main_unix.cpp b/src/unix/main_unix.cpp index 08087b6..94e7681 100644 --- a/src/unix/main_unix.cpp +++ b/src/unix/main_unix.cpp @@ -265,7 +265,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) if ((strcmp(dir->d_name, ".") == 0) || (strcmp(dir->d_name, "..") == 0)) continue; - utf8_int8_t complete_file_path[MAX_INPUT_LENGTH]; + utf8_int8_t* complete_file_path = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); strcpy(complete_file_path, search_dir); strcat(complete_file_path, "/"); strcat(complete_file_path, dir->d_name); @@ -283,7 +283,7 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) (void)matched_filter; - utf8_int8_t complete_file_path[MAX_INPUT_LENGTH]; + utf8_int8_t* complete_file_path = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); strcpy(complete_file_path, search_dir); strcat(complete_file_path, "/"); strcat(complete_file_path, dir->d_name); diff --git a/src/windows/main_windows.cpp b/src/windows/main_windows.cpp index f7f2901..fa55d9c 100644 --- a/src/windows/main_windows.cpp +++ b/src/windows/main_windows.cpp @@ -393,14 +393,14 @@ void ts_platform_list_files_block(ts_search_result* result, wchar_t* start_dir) (file_info.dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE)) { char *matched_filter = 0; - utf8_int8_t uni_name[MAX_INPUT_LENGTH]; + utf8_int8_t* uni_name = (utf8_int8_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); WideCharToMultiByte(CP_UTF8,0,name,-1,(LPSTR)uni_name,MAX_INPUT_LENGTH, NULL, NULL); if (ts_filter_matches(&result->filters, uni_name, &matched_filter) == (size_t)-1) { continue; } (void)matched_filter; - wchar_t complete_file_path[MAX_INPUT_LENGTH]; + wchar_t* complete_file_path = (wchar_t*)ts_memory_bucket_reserve(&result->memory, MAX_INPUT_LENGTH); 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); |
