Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glib: fix UB in VariantStrIter::impl_get #1343

Merged
merged 1 commit into from
Mar 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions glib/src/variant_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// introduce a heap allocation and doesn't provide a way to determine how
// many items are left in the iterator.

use std::iter::{DoubleEndedIterator, ExactSizeIterator, FusedIterator};

Check warning on line 7 in glib/src/variant_iter.rs

View workflow job for this annotation

GitHub Actions / build

the item `DoubleEndedIterator` is imported redundantly

use crate::{translate::*, Variant};

Expand Down Expand Up @@ -117,13 +117,13 @@

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
Loading