diff --git a/tor-dirmgr/src/storage/sqlite.rs b/tor-dirmgr/src/storage/sqlite.rs index 9f26b7da2..18919f48f 100644 --- a/tor-dirmgr/src/storage/sqlite.rs +++ b/tor-dirmgr/src/storage/sqlite.rs @@ -667,6 +667,23 @@ mod test { Ok(()) } + #[test] + fn bad_blob_fnames() -> Result<()> { + let (_tmp_dir, store) = new_empty()?; + + assert!(store.blob_fname("abcd").is_ok()); + assert!(store.blob_fname("abcd..").is_ok()); + assert!(store.blob_fname("..abcd..").is_ok()); + assert!(store.blob_fname(".abcd").is_ok()); + + assert!(store.blob_fname(".").is_err()); + assert!(store.blob_fname("..").is_err()); + assert!(store.blob_fname("../abcd").is_err()); + assert!(store.blob_fname("/abcd").is_err()); + + Ok(()) + } + #[test] fn blobs() -> Result<()> { let (tmp_dir, mut store) = new_empty()?;