diff options
Diffstat (limited to 'src/cstore/unionfs')
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.cpp | 7 | ||||
-rw-r--r-- | src/cstore/unionfs/cstore-unionfs.hpp | 5 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/cstore/unionfs/cstore-unionfs.cpp b/src/cstore/unionfs/cstore-unionfs.cpp index e2e27c6..da5d68e 100644 --- a/src/cstore/unionfs/cstore-unionfs.cpp +++ b/src/cstore/unionfs/cstore-unionfs.cpp @@ -1021,6 +1021,10 @@ UnionfsCstore::get_all_child_dir_names(b_fs::path root, vector<string>& nodes) bool UnionfsCstore::write_file(const string& file, const string& data) { + if (data.size() > C_UNIONFS_MAX_FILE_SIZE) { + output_internal("write_file too large\n"); + return false; + } try { // make sure the path exists b_fs::path fpath(file); @@ -1048,7 +1052,8 @@ UnionfsCstore::read_whole_file(const b_fs::path& fpath, string& data) return false; } try { - if (b_fs::file_size(fpath) > MAX_FILE_READ_SIZE) { + if (b_fs::file_size(fpath) > C_UNIONFS_MAX_FILE_SIZE) { + output_internal("read_whole_file too large\n"); return false; } diff --git a/src/cstore/unionfs/cstore-unionfs.hpp b/src/cstore/unionfs/cstore-unionfs.hpp index 3942e01..9799522 100644 --- a/src/cstore/unionfs/cstore-unionfs.hpp +++ b/src/cstore/unionfs/cstore-unionfs.hpp @@ -71,7 +71,10 @@ private: static const string C_VAL_NAME; static const string C_DEF_NAME; - static const size_t MAX_FILE_READ_SIZE = 8192; + /* max size for a file. + * currently this includes value file and comment file. + */ + static const size_t C_UNIONFS_MAX_FILE_SIZE = 262144; // root dirs (constant) b_fs::path work_root; // working root (union) |