Set max DB size to 8 MiB

This commit is contained in:
Ajeet D'Souza 2020-03-27 19:19:29 +05:30
parent 890185176e
commit 76dfaad9a1

View File

@ -20,7 +20,10 @@ impl DB {
let dirs = match File::open(&path) {
Ok(file) => {
let reader = BufReader::new(&file);
bincode::deserialize_from(reader).context("could not deserialize database")?
bincode::config()
.limit(8 * 1024 * 1024) // only databases upto 8 MiB are supported
.deserialize_from(reader)
.context("could not deserialize database")?
}
Err(err) => match err.kind() {
io::ErrorKind::NotFound => Vec::<Dir>::new(),