Skip to content

Commit

Permalink
Only unpack if it's save to do so
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Apr 23, 2023
1 parent 4ea816f commit 0c9fb5a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rye/src/utils.rs
Expand Up @@ -78,7 +78,9 @@ pub fn unpack_tarball(contents: &[u8], dst: &Path, strip_components: usize) -> R
components.next();
}
let path = dst.join(components.as_path());
if path != Path::new("") {

// only unpack if it's save to do so
if path != Path::new("") && path.strip_prefix(dst).is_ok() {
if let Some(dir) = path.parent() {
fs::create_dir_all(dir).ok();
}
Expand Down

0 comments on commit 0c9fb5a

Please sign in to comment.