mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 16:07:39 +00:00
Fix read_cert
crash when receive fd = -1
This commit is contained in:
parent
5fbd3e5c65
commit
927cd571f8
@ -138,6 +138,9 @@ pub fn read_certificate(fd: RawFd, version: i32) -> Vec<u8> {
|
|||||||
|
|
||||||
Err(bad_apk!("cannot find certificate"))
|
Err(bad_apk!("cannot find certificate"))
|
||||||
}
|
}
|
||||||
|
if fd == -1 {
|
||||||
|
return vec![];
|
||||||
|
}
|
||||||
let mut file = unsafe { File::from_raw_fd(fd) };
|
let mut file = unsafe { File::from_raw_fd(fd) };
|
||||||
let r = inner(&mut file, version).log().unwrap_or(vec![]);
|
let r = inner(&mut file, version).log().unwrap_or(vec![]);
|
||||||
std::mem::forget(file);
|
std::mem::forget(file);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user