fixing cicd formatting code
This commit is contained in:
@@ -404,7 +404,9 @@ mod platform {
|
||||
// Create memory reader closure
|
||||
let memory_reader = |pid: u32, addr: usize, size: usize| -> Result<Vec<u8>> {
|
||||
let handle = OpenProcess(PROCESS_VM_READ, false, pid).map_err(|e| {
|
||||
GhostError::MemoryRead { message: format!("OpenProcess failed: {}", e) }
|
||||
GhostError::MemoryRead {
|
||||
message: format!("OpenProcess failed: {}", e),
|
||||
}
|
||||
})?;
|
||||
|
||||
let mut buffer = vec![0u8; size];
|
||||
|
||||
@@ -288,12 +288,15 @@ fn parse_iat_from_disk(file_path: &str) -> Result<Vec<ImportEntry>> {
|
||||
use std::fs::File;
|
||||
use std::io::Read;
|
||||
|
||||
let mut file = File::open(file_path)
|
||||
.map_err(|e| GhostError::Configuration { message: format!("Failed to open file: {}", e) })?;
|
||||
let mut file = File::open(file_path).map_err(|e| GhostError::Configuration {
|
||||
message: format!("Failed to open file: {}", e),
|
||||
})?;
|
||||
|
||||
let mut buffer = Vec::new();
|
||||
file.read_to_end(&mut buffer)
|
||||
.map_err(|e| GhostError::Configuration { message: format!("Failed to read file: {}", e) })?;
|
||||
.map_err(|e| GhostError::Configuration {
|
||||
message: format!("Failed to read file: {}", e),
|
||||
})?;
|
||||
|
||||
parse_iat_from_buffer(&buffer)
|
||||
}
|
||||
@@ -301,10 +304,11 @@ fn parse_iat_from_disk(file_path: &str) -> Result<Vec<ImportEntry>> {
|
||||
/// Parse IAT from memory buffer
|
||||
#[cfg(windows)]
|
||||
fn parse_iat_from_buffer(buffer: &[u8]) -> Result<Vec<ImportEntry>> {
|
||||
|
||||
let reader = |_pid: u32, offset: usize, size: usize| -> Result<Vec<u8>> {
|
||||
if offset + size > buffer.len() {
|
||||
return Err(GhostError::MemoryRead { message: "Buffer overflow".to_string() });
|
||||
return Err(GhostError::MemoryRead {
|
||||
message: "Buffer overflow".to_string(),
|
||||
});
|
||||
}
|
||||
Ok(buffer[offset..offset + size].to_vec())
|
||||
};
|
||||
@@ -423,7 +427,9 @@ fn read_cstring(
|
||||
offset += 16;
|
||||
|
||||
if offset > 512 {
|
||||
return Err(GhostError::MemoryRead { message: "String too long".to_string() });
|
||||
return Err(GhostError::MemoryRead {
|
||||
message: "String too long".to_string(),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user