Skip to content

Commit

Permalink
Fix for arm
Browse files Browse the repository at this point in the history
  • Loading branch information
acookin committed Jan 14, 2025
1 parent c77346b commit f6e4091
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/capi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ fn strdup(rs_str: &str) -> *mut libc::c_char {
let c_str =
libc::malloc(std::mem::size_of::<*mut libc::c_char>() * rs_str.len() + 1)
as *mut libc::c_char;
std::ptr::copy_nonoverlapping(rs_str.as_ptr() as *const i8, c_str, rs_str.len());
std::ptr::copy_nonoverlapping(rs_str.as_ptr() as *const libc::c_char, c_str, rs_str.len());
let nul = "\0";
std::ptr::copy_nonoverlapping(
nul.as_ptr() as *const i8,
nul.as_ptr() as *const libc::c_char,
c_str.add(rs_str.len()),
nul.len(),
);
Expand Down

0 comments on commit f6e4091

Please sign in to comment.