android: avoid UAF

This commit is contained in:
eric committed 2024-02-27 10:15:03 +08:00
1 parent 15cc8f9d2d
commit 3bbb5f7955
1 file changed
+2 -5
+2 -5
View File
@@ -37,13 +37,10 @@ fn log_out(data: &[u8]) {
Ok(s) => s,
Err(_) => return,
};
const ANDROID_LOG_TAG: &str = "leaf";
let tag = ffi::CString::new("leaf").unwrap();
let _ = __android_log_print(
android_LogPriority_ANDROID_LOG_VERBOSE as std::os::raw::c_int,
ffi::CString::new(ANDROID_LOG_TAG)
.unwrap()
.as_c_str()
.as_ptr(),
tag.as_c_str().as_ptr(),
s.as_c_str().as_ptr(),
);
}