Skip to content

Commit

Permalink
fix /usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games macro init
Browse files Browse the repository at this point in the history
  • Loading branch information
netblue30 committed Dec 22, 2023
1 parent bf5a993 commit 619e58e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/firejail/paths.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,23 +76,32 @@ static void init_paths(void) {
if (bin_symlink > 0) {
if (strcmp(elt, "/bin") == 0 || strcmp(elt, "/usr/bin") == 0)
bin_symlink++;
if (bin_symlink == 3)
if (bin_symlink == 3) {
bin_symlink = 0;
if (arg_debug)
printf("...skip path %s\n", elt);
goto skip;
}
}

// filter out duplicate entries
for (j = 0; j < i; j++)
if (strcmp(elt, paths[j]) == 0)
goto skip;

if (arg_debug)
printf("Add path entry %s\n", elt);
paths[i++] = elt;
if (len > longest_path_elt)
longest_path_elt = len;

skip:;
skip:;
}

assert(paths[i] == NULL);
path_cnt = i;
if (arg_debug)
printf("Number of path entries: %d\n", path_cnt);

// path_cnt may be too big now, if entries were skipped above
path_cnt = i+1;
}
Expand Down

0 comments on commit 619e58e

Please sign in to comment.