diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index c370dbbd5..417145265 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -39,11 +39,11 @@ lazy_static! { #[no_mangle] #[allow(clippy::missing_safety_doc)] pub unsafe extern "C" fn cairo_native__get_version(target: *mut u8, length: usize) -> usize { - let target = slice::from_raw_parts_mut(target, length); - let version = env!("CARGO_PKG_VERSION"); assert!(length > version.len(), "version buffer not big enough"); + let target = slice::from_raw_parts_mut(target, version.len()); + target.copy_from_slice(version.as_bytes()); target[version.len()] = b'\0';