Skip to content

Commit 591be39

Browse files
committed
Fix CString/CStr bug which was causing memory corruption in previous update
1 parent ba1f119 commit 591be39

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ impl Request for DefaultRequest {
155155
if param.is_null() {
156156
return None;
157157
}
158-
let result_cstr = ffi::CString::from_ptr(param);
158+
let result_cstr = ffi::CStr::from_ptr(param);
159159
let result_str = result_cstr.to_str().unwrap();
160160
return Some(String::from(result_str));
161161
}
@@ -182,7 +182,7 @@ impl Request for DefaultRequest {
182182
let pdst = buffer.as_mut_ptr();
183183
let byte_count = capi::FCGX_GetStr(pdst, n, self.raw_request.in_stream);
184184
buffer.set_len(byte_count as usize);
185-
let result_cstr = ffi::CString::from_ptr(pdst);
185+
let result_cstr = ffi::CStr::from_ptr(pdst);
186186
let result_str = result_cstr.to_str().unwrap();
187187
return (String::from(result_str), byte_count);
188188
}

0 commit comments

Comments
 (0)