Skip to content

Commit 781731b

Browse files
committed
bugfix: use CString when passing path across FFI
1 parent a326bd6 commit 781731b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/memory_buffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl MemoryBuffer {
2626
}
2727

2828
pub fn create_from_file(path: &Path) -> Result<Self, LLVMString> {
29-
let path = path.to_str().expect("Did not find a valid Unicode path string");
29+
let path = CString::new(path.to_str().expect("Did not find a valid Unicode path string")).expect("Failed to convert to CString");
3030
let mut memory_buffer = ptr::null_mut();
3131
let mut err_string = unsafe { zeroed() };
3232

0 commit comments

Comments
 (0)