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

Commit a7d6c674 authored by 张倞诚's avatar 张倞诚
Browse files

Fix incorrect gid config leads to process/system cannot start.

We found that if the system application misconfigures the gid in the permissions, -1 will be added to the application's gid list, which will cause the application process or system startup to fail, so consider adding a check to prevent this unexpected situation.

Change-Id: Ic3133067285ecfd9310b4bca56ff402180e7c2aa
parent 3ff587dd
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1638,7 +1638,13 @@ public class SystemConfig {
                String gidStr = parser.getAttributeValue(null, "gid");
                if (gidStr != null) {
                    int gid = Process.getGidForName(gidStr);
                    if (gid != -1) {
                        perm.gids = appendInt(perm.gids, gid);
                    } else {
                        Slog.w(TAG, "<group> with unknown gid \""
                                + gidStr + " for permission " + name + " in "
                                + parser.getPositionDescription());
                    }
                } else {
                    Slog.w(TAG, "<group> without gid at "
                            + parser.getPositionDescription());