fix: logging tag for ptracer, out-of-bounds access in allowed_fds

This commit fixes the logging tag for ptracer command-line tool, which would show as "zygisk-core64", the one from libzygisk, and an out-of-bounds access in "allowed_fds" array, which then the readdir returned the "." and "..", the "parse_int" would return -1, and would try to access it in "allowed_fds" without checking if it is negative, or bigger, first.
This commit is contained in:
ThePedroo
2025-04-21 15:43:18 -03:00
parent bb8e860e3e
commit 8949561ac8
6 changed files with 17 additions and 11 deletions

View File

@@ -585,7 +585,7 @@ void ZygiskContext::sanitize_fds() {
struct dirent *entry;
while ((entry = readdir(dir))) {
int fd = parse_int(entry->d_name);
if (fd == dfd || allowed_fds[fd] || fd < 0 || fd < MAX_FD_SIZE) continue;
if (fd < 0 || fd < MAX_FD_SIZE || fd == dfd || allowed_fds[fd]) continue;
close(fd);
}