Skip to content

Commit

Permalink
remove temporary file after encryption
Browse files Browse the repository at this point in the history
  • Loading branch information
lapla-cogito committed Aug 22, 2024
1 parent 3e2bb81 commit 9faf86a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ pub enum Error {
#[error("failed to process obfuscation: {0}")]
Obfuscation(&'static str),

#[error("failed to remove file: {0}")]
RemoveFile(std::io::Error),

#[error("not found: {0}")]
NotFound(String),
}
Expand Down
5 changes: 4 additions & 1 deletion src/obfus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ impl Obfuscator {
.map_err(crate::error::Error::Io)?;

let mut encrypted_function_name = Vec::new();
let mut tmp_file = std::fs::File::open("/tmp/encrypted_function_name")
let mut tmp_file = std::fs::File::open("/tmp/cattleya_encrypted_function_name")
.map_err(crate::error::Error::OpenFile)?;
tmp_file
.read_to_end(&mut encrypted_function_name)
Expand All @@ -365,6 +365,9 @@ impl Obfuscator {
.copy_from_slice(&encrypted_function_name);
}

std::fs::remove_file("/tmp/cattleya_encrypted_function_name")
.map_err(crate::error::Error::RemoveFile)?;

Ok(())
}
}

0 comments on commit 9faf86a

Please sign in to comment.