Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 39709e6b authored by Ling Ma's avatar Ling Ma Committed by Automerger Merge Worker
Browse files

Merge "setProperty check for byte limit" am: 18b48023 am: 4cd99146

parents eb897b1d 4cd99146
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -226,9 +226,10 @@ public class SystemProperties {
     */
    @UnsupportedAppUsage
    public static void set(@NonNull String key, @Nullable String val) {
        if (val != null && !key.startsWith("ro.") && val.length() > PROP_VALUE_MAX) {
        if (val != null && !key.startsWith("ro.") && val.getBytes(StandardCharsets.UTF_8).length
                > PROP_VALUE_MAX) {
            throw new IllegalArgumentException("value of system property '" + key
                    + "' is longer than " + PROP_VALUE_MAX + " characters: " + val);
                    + "' is longer than " + PROP_VALUE_MAX + " bytes: " + val);
        }
        if (TRACK_KEY_ACCESS) onKeyAccess(key);
        native_set(key, val);