diff options
Diffstat (limited to 'src/firejail/preproc.c')
-rw-r--r-- | src/firejail/preproc.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/firejail/preproc.c b/src/firejail/preproc.c index fe5f2eb44..ea4e6743f 100644 --- a/src/firejail/preproc.c +++ b/src/firejail/preproc.c | |||
@@ -104,16 +104,8 @@ void preproc_build_cp_command(void) { | |||
104 | preproc_mount_mnt_dir(); | 104 | preproc_mount_mnt_dir(); |
105 | if (stat(RUN_CP_COMMAND, &s)) { | 105 | if (stat(RUN_CP_COMMAND, &s)) { |
106 | char* fname = realpath("/bin/cp", NULL); | 106 | char* fname = realpath("/bin/cp", NULL); |
107 | if (fname == NULL) { | 107 | if (fname == NULL || stat(fname, &s) || is_link(fname)) { |
108 | fprintf(stderr, "Error: /bin/cp not found\n"); | 108 | fprintf(stderr, "Error: invalid /bin/cp\n"); |
109 | exit(1); | ||
110 | } | ||
111 | if (stat(fname, &s)) { | ||
112 | fprintf(stderr, "Error: /bin/cp not found\n"); | ||
113 | exit(1); | ||
114 | } | ||
115 | if (is_link(fname)) { | ||
116 | fprintf(stderr, "Error: invalid /bin/cp file\n"); | ||
117 | exit(1); | 109 | exit(1); |
118 | } | 110 | } |
119 | int rv = copy_file(fname, RUN_CP_COMMAND, 0, 0, 0755); | 111 | int rv = copy_file(fname, RUN_CP_COMMAND, 0, 0, 0755); |