Ignore validating class name of isolated process name
Fix #4176 Co-authored-by: topjohnwu <topjohnwu@gmail.com>
This commit is contained in:
parent
2b65e1ffc2
commit
f4ac7c8e7c
@ -99,24 +99,40 @@ static void kill_process(const char *name, bool multi = false,
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool validate(const char *s) {
|
static bool validate(const char *pkg, const char *proc) {
|
||||||
if (strcmp(s, ISOLATED_MAGIC) == 0)
|
bool pkg_valid = false;
|
||||||
return true;
|
bool proc_valid = true;
|
||||||
bool dot = false;
|
|
||||||
for (char c; (c = *s); ++s) {
|
if (str_eql(pkg, ISOLATED_MAGIC)) {
|
||||||
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ||
|
pkg_valid = true;
|
||||||
(c >= '0' && c <= '9') || c == '_' || c == ':') {
|
for (char c; (c = *proc); ++proc) {
|
||||||
continue;
|
if (isalnum(c) || c == '_' || c == '.')
|
||||||
|
continue;
|
||||||
|
if (c == ':')
|
||||||
|
break;
|
||||||
|
proc_valid = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (SDK_INT >= 29 && c == '$')
|
} else {
|
||||||
continue;
|
for (char c; (c = *pkg); ++pkg) {
|
||||||
if (c == '.') {
|
if (isalnum(c) || c == '_')
|
||||||
dot = true;
|
continue;
|
||||||
continue;
|
if (c == '.') {
|
||||||
|
pkg_valid = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
pkg_valid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (char c; (c = *proc); ++proc) {
|
||||||
|
if (isalnum(c) || c == '_' || c == ':' || c == '.')
|
||||||
|
continue;
|
||||||
|
proc_valid = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return dot;
|
return pkg_valid && proc_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_hide_set(const char *pkg, const char *proc) {
|
static void add_hide_set(const char *pkg, const char *proc) {
|
||||||
@ -134,7 +150,7 @@ static int add_list(const char *pkg, const char *proc) {
|
|||||||
if (proc[0] == '\0')
|
if (proc[0] == '\0')
|
||||||
proc = pkg;
|
proc = pkg;
|
||||||
|
|
||||||
if (!validate(pkg) || !validate(proc))
|
if (!validate(pkg, proc))
|
||||||
return HIDE_INVALID_PKG;
|
return HIDE_INVALID_PKG;
|
||||||
|
|
||||||
for (auto &hide : hide_set)
|
for (auto &hide : hide_set)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user