Skip to content

Commit

Permalink
Merge pull request #1343 from decathorpe/master
Browse files Browse the repository at this point in the history
glib: fix UB in VariantStrIter::impl_get
  • Loading branch information
sdroege authored Mar 30, 2024
2 parents e24f5fc + b5a4071 commit 05dff0e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions glib/src/variant_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,13 @@ impl<'a> VariantStrIter<'a> {

fn impl_get(&self, i: usize) -> &'a str {
unsafe {
let p: *mut libc::c_char = std::ptr::null_mut();
let mut p: *mut libc::c_char = std::ptr::null_mut();
let s = b"&s\0";
ffi::g_variant_get_child(
self.variant.to_glib_none().0,
i,
s as *const u8 as *const _,
&p,
&mut p,
std::ptr::null::<i8>(),
);
let p = std::ffi::CStr::from_ptr(p);
Expand Down

0 comments on commit 05dff0e

Please sign in to comment.