mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 01:07:55 +00:00
Check null before dereferencing fds_to_ignore
This commit is contained in:
parent
13ef3058c6
commit
0c681cdab4
@ -394,15 +394,17 @@ void HookContext::run_modules_pre(const vector<int> &fds) {
|
||||
|
||||
// Add all ignored fd onto whitelist
|
||||
if (state[APP_SPECIALIZE] && args->fds_to_ignore) {
|
||||
int len = env->GetArrayLength(*args->fds_to_ignore);
|
||||
int *arr = env->GetIntArrayElements(*args->fds_to_ignore, nullptr);
|
||||
if (jintArray fdsToIgnore = *args->fds_to_ignore) {
|
||||
int len = env->GetArrayLength(fdsToIgnore);
|
||||
int *arr = env->GetIntArrayElements(fdsToIgnore, nullptr);
|
||||
for (int i = 0; i < len; ++i) {
|
||||
int fd = arr[i];
|
||||
if (fd >= 0 && fd < 1024) {
|
||||
open_fds[fd] = true;
|
||||
}
|
||||
}
|
||||
env->ReleaseIntArrayElements(*args->fds_to_ignore, arr, 0);
|
||||
env->ReleaseIntArrayElements(fdsToIgnore, arr, JNI_ABORT);
|
||||
}
|
||||
}
|
||||
|
||||
// Close all unrecorded fds
|
||||
|
Loading…
x
Reference in New Issue
Block a user