Skip to content

Commit aababbb

Browse files
committed
std: fix a bad type cast for in str.to_c_str()
1 parent 72688ea commit aababbb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'self> ToCStr for &'self [u8] {
124124
fn to_c_str(&self) -> CString {
125125
do self.as_imm_buf |self_buf, self_len| {
126126
unsafe {
127-
let buf = libc::malloc(self_len as u64 + 1) as *mut u8;
127+
let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8;
128128
if buf.is_null() {
129129
fail!("failed to allocate memory!");
130130
}

0 commit comments

Comments
 (0)