Skip to content

Commit 059c7f4

Browse files
Merge pull request #250 from Tcode-Motion/security-fix-tar-unpack-2200096652374879433
🔒 [security fix directory traversal in tar unpack]
2 parents 260cf16 + ceb1f26 commit 059c7f4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎stdlib/src/compress.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ pub fn untar_archive(archive_path: &str, dest_dir: &str) -> std::io::Result<()>
283283
// from escaping the destination directory. Therefore, we revert the manual
284284
// path validation that caused a regression with uncanonicalized relative paths.
285285

286-
a.unpack(dest_dir)?;
286+
for entry in a.entries()? {
287+
let mut entry = entry?;
288+
entry.unpack_in(dest_dir)?;
289+
}
287290
Ok(())
288291
}
289292

0 commit comments

Comments
 (0)