summaryrefslogtreecommitdiff
path: root/src/delete.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/delete.rs')
-rw-r--r--src/delete.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/delete.rs b/src/delete.rs
index 6966f82..094e4c4 100644
--- a/src/delete.rs
+++ b/src/delete.rs
@@ -175,7 +175,13 @@ pub fn remove_package_files_only(_pkg_name: &str, files: &[String]) -> bool {
let mut failed = false;
for rel_path in files {
- let full_path = Path::new("/").join(rel_path);
+ let clean = rel_path.trim_start_matches('/');
+ if clean.contains("..") || clean.is_empty() {
+ eprintln!("{} Skipping suspicious path: {}", "[ror]".red().bold(), rel_path);
+ failed = true;
+ continue;
+ }
+ let full_path = Path::new("/").join(clean);
if full_path.exists() {
debug!("Removing file {}", full_path.display());
if let Err(e) = fs::remove_file(&full_path) {