protect against writes outside of output directory

This commit is contained in:
Trevor Bentley
2023-01-12 21:02:38 +01:00
parent bc29ccd66a
commit 99cdc02af5
2 changed files with 51 additions and 33 deletions
+2 -1
View File
@@ -126,7 +126,8 @@ macro_rules! output_path_fn {
_ => tmpl_str,
};
let tmpl = PathBuf::from(tmpl_str);
let mut path = self.path.clone();
let mut path = self.path.clone().canonicalize()
.expect(&format!("ERROR: unable to canonicalize output path: {}", self.path.display()));
path.push(tmpl);
match $is_dir {
true => {