Skip to content

Commit 19bb64c

Browse files
committed
fix: exempted fds not being added to fds_to_ignore
This commit fixes the issue that when `fds_to_ignore` is NULL. Instead of creating an array and adding the exempted fds to it when NULL, it would ignore. Not only leading to issues in modules, but could even crashes if the module closes some fd that is now owned by Zygote. This only affects "nativeForkAndSpecialize", which is usually used by Chrome/WebView for isolation.
1 parent 7e3db00 commit 19bb64c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

loader/src/injector/hook.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,8 @@ static void rz_sanitize_fds(struct zygisk_context *ctx) {
808808
jintArray fdsToIgnore = ctx->args.app->fds_to_ignore ? *ctx->args.app->fds_to_ignore : NULL;
809809
mark_fds_allowed(ctx, ctx->env, fdsToIgnore);
810810

811-
if (fdsToIgnore && ctx->exempted_fds_count > 0) {
812-
jint len = (*ctx->env)->GetArrayLength(ctx->env, fdsToIgnore);
811+
if (ctx->exempted_fds_count > 0) {
812+
jint len = fdsToIgnore ? (*ctx->env)->GetArrayLength(ctx->env, fdsToIgnore) : 0;
813813
jintArray newArray = (*ctx->env)->NewIntArray(ctx->env, (jsize)(len + ctx->exempted_fds_count));
814814
if (newArray) {
815815
if (fdsToIgnore && len > 0) {

0 commit comments

Comments
 (0)