From 93b32882eec35546a3efd05a9e260664b2f5da78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 Jul 2018 10:17:38 +0300 Subject: [PATCH] tags: Use to_glib_none() to convert &str to a C string instead of as_ptr() The latter does not necessarily give us a NUL-terminated string. Fixes https://github.com/sdroege/gstreamer-rs/issues/122 --- gstreamer/src/tags.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gstreamer/src/tags.rs b/gstreamer/src/tags.rs index 6ec7272d1..29072d690 100644 --- a/gstreamer/src/tags.rs +++ b/gstreamer/src/tags.rs @@ -193,8 +193,10 @@ impl TagListRef { unsafe { let v = value.to_send_value(); + let tag_name = tag_name.to_glib_none(); + let tag_type: glib::Type = from_glib( - ffi::gst_tag_get_type(tag_name.as_ptr() as *const i8) + ffi::gst_tag_get_type(tag_name.0) ); if tag_type != v.type_() { return Err(TagError::TypeMismatch) @@ -203,7 +205,7 @@ impl TagListRef { ffi::gst_tag_list_add_value( self.as_mut_ptr(), mode.to_glib(), - tag_name.to_glib_none().0, + tag_name.0, v.to_glib_none().0, ); }