diff options
| author | 2024-01-09 21:14:50 +0000 | |
|---|---|---|
| committer | 2024-01-09 21:14:50 +0000 | |
| commit | 55e27576181f3a252c8e54a5a777ad52f2b64f99 (patch) | |
| tree | 96a8f7f0c4b811e34e8a8c9961c52a4f8c770a42 | |
| parent | a3f575d75e2661cece4d9d1d60c5159ce36eb0a6 (diff) | |
| parent | 7ba059e2cf0a2c20f9a849719cdc32b12c933a44 (diff) | |
Merge "Check hidden API exemptions" into main
| -rw-r--r-- | core/java/android/os/ZygoteProcess.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java index c14810bbcd64..f3496e7f2592 100644 --- a/core/java/android/os/ZygoteProcess.java +++ b/core/java/android/os/ZygoteProcess.java @@ -425,6 +425,8 @@ public class ZygoteProcess { throw new ZygoteStartFailedEx("Embedded newlines not allowed"); } else if (arg.indexOf('\r') >= 0) { throw new ZygoteStartFailedEx("Embedded carriage returns not allowed"); + } else if (arg.indexOf('\u0000') >= 0) { + throw new ZygoteStartFailedEx("Embedded nulls not allowed"); } } @@ -965,6 +967,14 @@ public class ZygoteProcess { return true; } + for (/* NonNull */ String s : mApiDenylistExemptions) { + // indexOf() is intrinsified and faster than contains(). + if (s.indexOf('\n') >= 0 || s.indexOf('\r') >= 0 || s.indexOf('\u0000') >= 0) { + Slog.e(LOG_TAG, "Failed to set API denylist exemptions: Bad character"); + mApiDenylistExemptions = Collections.emptyList(); + return false; + } + } try { state.mZygoteOutputWriter.write(Integer.toString(mApiDenylistExemptions.size() + 1)); state.mZygoteOutputWriter.newLine(); |