Skip to content

Commit

Permalink
Fix Vec<c_char> being hardcoded to Vec<i8>
Browse files Browse the repository at this point in the history
  • Loading branch information
jamcleod committed Jan 31, 2024
1 parent 208cd04 commit 6324814
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion panda-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "panda-re"
version = "0.46.1"
version = "0.46.2"
authors = ["Jordan McLeod <[email protected]>", "tnballo <[email protected]>"]
edition = "2018"
description = "The official library for interfacing with PANDA (Platform for Architecture-Neutral Dynamic Analysis)"
Expand Down
4 changes: 2 additions & 2 deletions panda-rs/src/api/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ pub fn virtual_memory_write(cpu: &mut CPUState, addr: target_ulong, data: &[u8])
panda_sys::panda_virtual_memory_write_external(
cpu,
addr,
c_data.as_mut_ptr() as *mut i8,
c_data.as_mut_ptr() as *mut c_char,
c_data.len() as i32,
)
.into()
Expand Down Expand Up @@ -290,7 +290,7 @@ pub fn virt_memory_dump(cpu: &mut CPUState, addr: target_ptr_t, len: usize) {

// https://stackoverflow.com/questions/59707349/cast-vector-of-i8-to-vector-of-u8-in-rust/59707887#59707887
// TODO: replace with https://doc.rust-lang.org/std/vec/struct.Vec.html#method.into_raw_parts, once on stable
fn vec_i8_into_u8(v: Vec<i8>) -> Vec<u8> {
fn vec_i8_into_u8(v: Vec<c_char>) -> Vec<u8> {
// Make sure v's destructor doesn't free the data it thinks it owns when it goes out of scope
let mut v = std::mem::ManuallyDrop::new(v);

Expand Down

0 comments on commit 6324814

Please sign in to comment.