diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-28 14:55:09 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-05-28 14:58:22 +0100 |
commit | 5a412b7a3f5b7c53d9777d58fe1e6bd11a205596 (patch) | |
tree | 7983a712ea7aa775c3c7e452b3e58bdd5fa6742e /contrib/epee | |
parent | Merge pull request #3800 (diff) | |
download | monero-5a412b7a3f5b7c53d9777d58fe1e6bd11a205596.tar.xz |
disable file size sanity check when loading the wallet cache
Diffstat (limited to 'contrib/epee')
-rw-r--r-- | contrib/epee/include/file_io_utils.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/epee/include/file_io_utils.h b/contrib/epee/include/file_io_utils.h index 196610674..0afff800f 100644 --- a/contrib/epee/include/file_io_utils.h +++ b/contrib/epee/include/file_io_utils.h @@ -128,7 +128,7 @@ namespace file_io_utils inline - bool load_file_to_string(const std::string& path_to_file, std::string& target_str) + bool load_file_to_string(const std::string& path_to_file, std::string& target_str, size_t max_size = 1000000000) { #ifdef WIN32 WCHAR wide_path[1000]; @@ -139,7 +139,7 @@ namespace file_io_utils if (file_handle == INVALID_HANDLE_VALUE) return false; DWORD file_size = GetFileSize(file_handle, NULL); - if ((file_size == INVALID_FILE_SIZE) || (file_size > 1000000000)) { + if ((file_size == INVALID_FILE_SIZE) || (uint64_t)file_size > (uint64_t)max_size) { CloseHandle(file_handle); return false; } @@ -159,7 +159,7 @@ namespace file_io_utils std::ifstream::pos_type file_size = fstream.tellg(); - if(file_size > 1000000000) + if((uint64_t)file_size > (uint64_t)max_size) // ensure a large domain for comparison, and negative -> too large return false;//don't go crazy size_t file_size_t = static_cast<size_t>(file_size); |