Skip to content

Commit 712793e

Browse files
authored
Merge pull request rust-lang#84 from cdisselkoen/memorybuffer-create_from_file-bugfix
bugfix: use CString when passing path across FFI
2 parents a326bd6 + 781731b commit 712793e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/memory_buffer.rs

+1-1
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)