Limit namespace length.

Limit namespace length to 1000 characters to avoid memory or other
potential issues.

Bug: 281553712
Test: atest CtsJobSchedulerTestCases
Change-Id: I8c99ce6c5e9a23a38f91a00bdf22e80d08389f32
This commit is contained in:
Kweku Adams
2023-05-08 19:23:28 +00:00
parent 22490466ca
commit e3407ec222

View File

@@ -4124,6 +4124,10 @@ public class JobSchedulerService extends com.android.server.SystemService
if (namespace.isEmpty()) {
throw new IllegalArgumentException("namespace cannot be empty");
}
if (namespace.length() > 1000) {
throw new IllegalArgumentException(
"namespace cannot be more than 1000 characters");
}
namespace = namespace.intern();
}
return namespace;