Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rangedetails path #123

Merged
merged 11 commits into from
Jan 8, 2024
8 changes: 5 additions & 3 deletions frida-gum/src/range_details.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
allow(clippy::unnecessary_cast)
)]

extern crate alloc;
use {
crate::MemoryRange,
alloc::string::String,
core::{
ffi::{c_void, CStr},
marker::PhantomData,
Expand Down Expand Up @@ -42,7 +44,7 @@ pub enum PageProtection {
/// The file association to a page.
#[derive(Clone)]
pub struct FileMapping<'a> {
path: &'a str,
path: String,
size: usize,
offset: u64,
phantom: PhantomData<&'a gum_sys::GumFileMapping>,
Expand All @@ -55,7 +57,7 @@ impl<'a> FileMapping<'a> {
} else {
Some(unsafe {
Self {
path: CStr::from_ptr((*file).path).to_str().unwrap(),
path: CStr::from_ptr((*file).path).to_string_lossy().into_owned(),
size: (*file).size as usize,
offset: (*file).offset,
phantom: PhantomData,
Expand All @@ -66,7 +68,7 @@ impl<'a> FileMapping<'a> {

/// The path of the file mapping on disk.
pub fn path(&self) -> &str {
self.path
&self.path
}

/// The offset into the file mapping.
Expand Down
Loading