]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
smartlist.rs: The libc::c_char type is not the same as i8.
authorNick Mathewson <nickm@torproject.org>
Thu, 4 Jan 2018 17:20:54 +0000 (12:20 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 4 Jan 2018 17:21:55 +0000 (12:21 -0500)
The code had been using c_char and i8 interchangeably, but it turns
out that c_char is only i8 on platforms where "char" is signed. On
other platforms, c_char is u8.

Fixes bug 24794; bug not on any released Tor.

src/rust/smartlist/smartlist.rs

index ec5d7a57f51542d8aa76d06f20e6d68e4bc4c1b0..2a822d89f458ef63e529c0198254be1fef844784 100644 (file)
@@ -33,7 +33,7 @@ impl Smartlist<String> for Stringlist {
 
         // unsafe, as we need to extract the smartlist list into a vector of
         // pointers, and then transform each element into a Rust string.
-        let elems: &[*const i8] =
+        let elems: &[*const c_char] =
             unsafe { slice::from_raw_parts(self.list, self.num_used as usize) };
 
         for elem in elems.iter() {