diff options
Diffstat (limited to 'src/firejail')
-rw-r--r-- | src/firejail/Makefile.in | 2 | ||||
-rw-r--r-- | src/firejail/fs.c | 2 | ||||
-rw-r--r-- | src/firejail/main.c | 4 | ||||
-rw-r--r-- | src/firejail/netfilter.c | 2 | ||||
-rw-r--r-- | src/firejail/profile.c | 2 | ||||
-rw-r--r-- | src/firejail/sandbox.c | 3 | ||||
-rw-r--r-- | src/firejail/seccomp.c | 2 | ||||
-rw-r--r-- | src/firejail/util.c | 5 |
8 files changed, 13 insertions, 9 deletions
diff --git a/src/firejail/Makefile.in b/src/firejail/Makefile.in index 1f7b563c4..fca86be4d 100644 --- a/src/firejail/Makefile.in +++ b/src/firejail/Makefile.in | |||
@@ -12,7 +12,7 @@ H_FILE_LIST = $(wildcard *.[h]) | |||
12 | C_FILE_LIST = $(wildcard *.c) | 12 | C_FILE_LIST = $(wildcard *.c) |
13 | OBJS = $(C_FILE_LIST:.c=.o) | 13 | OBJS = $(C_FILE_LIST:.c=.o) |
14 | BINOBJS = $(foreach file, $(OBJS), $file) | 14 | BINOBJS = $(foreach file, $(OBJS), $file) |
15 | CFLAGS += -ggdb -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(PREFIX)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security | 15 | CFLAGS += -ggdb -W -Wall -Werror -O2 -DVERSION='"$(VERSION)"' -DPREFIX='"$(PREFIX)"' $(HAVE_SECCOMP) $(HAVE_SECCOMP_H) $(HAVE_CHROOT) $(HAVE_BIND) -fstack-protector-all -D_FORTIFY_SOURCE=2 -fPIE -pie -Wformat -Wformat-security |
16 | LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread | 16 | LDFLAGS += -pie -Wl,-z,relro -Wl,-z,now -lpthread |
17 | 17 | ||
18 | %.o : %.c $(H_FILE_LIST) | 18 | %.o : %.c $(H_FILE_LIST) |
diff --git a/src/firejail/fs.c b/src/firejail/fs.c index 38946c8d9..428ea0819 100644 --- a/src/firejail/fs.c +++ b/src/firejail/fs.c | |||
@@ -199,7 +199,7 @@ static void globbing(OPERATION op, const char *fname, const char *emptydir, cons | |||
199 | glob_t globbuf; | 199 | glob_t globbuf; |
200 | globbuf.gl_offs = 0; | 200 | globbuf.gl_offs = 0; |
201 | glob(fname, GLOB_DOOFFS, NULL, &globbuf); | 201 | glob(fname, GLOB_DOOFFS, NULL, &globbuf); |
202 | int i; | 202 | unsigned int i; |
203 | for (i = 0; i < globbuf.gl_pathc; i++) { | 203 | for (i = 0; i < globbuf.gl_pathc; i++) { |
204 | assert(globbuf.gl_pathv[i]); | 204 | assert(globbuf.gl_pathv[i]); |
205 | disable_file(op, globbuf.gl_pathv[i], emptydir, emptyfile); | 205 | disable_file(op, globbuf.gl_pathv[i], emptydir, emptyfile); |
diff --git a/src/firejail/main.c b/src/firejail/main.c index 3c7a8401e..14a5d9d47 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c | |||
@@ -175,7 +175,7 @@ static inline Bridge *last_bridge_configured(void) { | |||
175 | static int read_pid(char *str, pid_t *pid) { | 175 | static int read_pid(char *str, pid_t *pid) { |
176 | char *endptr; | 176 | char *endptr; |
177 | errno = 0; | 177 | errno = 0; |
178 | pid_t pidtmp = strtol(str, &endptr, 10); | 178 | long int pidtmp = strtol(str, &endptr, 10); |
179 | if ((errno == ERANGE && (pidtmp == LONG_MAX || pidtmp == LONG_MIN)) | 179 | if ((errno == ERANGE && (pidtmp == LONG_MAX || pidtmp == LONG_MIN)) |
180 | || (errno != 0 && pidtmp == 0)) { | 180 | || (errno != 0 && pidtmp == 0)) { |
181 | return 1; | 181 | return 1; |
@@ -183,7 +183,7 @@ static int read_pid(char *str, pid_t *pid) { | |||
183 | if (endptr == str) { | 183 | if (endptr == str) { |
184 | return 1; | 184 | return 1; |
185 | } | 185 | } |
186 | *pid = pidtmp; | 186 | *pid = (pid_t)pidtmp; |
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
diff --git a/src/firejail/netfilter.c b/src/firejail/netfilter.c index fd8a9b2f3..da13d8092 100644 --- a/src/firejail/netfilter.c +++ b/src/firejail/netfilter.c | |||
@@ -79,7 +79,7 @@ void netfilter(const char *fname) { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | size_t sz = fread(filter, 1, s.st_size, fp); | 81 | size_t sz = fread(filter, 1, s.st_size, fp); |
82 | if (sz != s.st_size) { | 82 | if ((off_t)sz != s.st_size) { |
83 | fprintf(stderr, "Error: cannot read network filter file\n"); | 83 | fprintf(stderr, "Error: cannot read network filter file\n"); |
84 | exit(1); | 84 | exit(1); |
85 | } | 85 | } |
diff --git a/src/firejail/profile.c b/src/firejail/profile.c index 39b0710cb..e9a2e55a3 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c | |||
@@ -69,7 +69,7 @@ static void check_file_name(char *ptr, int lineno) { | |||
69 | 69 | ||
70 | int len = strlen(ptr); | 70 | int len = strlen(ptr); |
71 | // file globbing ('*') is allowed | 71 | // file globbing ('*') is allowed |
72 | if (strcspn(ptr, "\\&!?\"'<>%^(){}[];,") != len) { | 72 | if (strcspn(ptr, "\\&!?\"'<>%^(){}[];,") != (size_t)len) { |
73 | if (lineno == 0) | 73 | if (lineno == 0) |
74 | fprintf(stderr, "Error: \"%s\" is an invalid filename\n", ptr); | 74 | fprintf(stderr, "Error: \"%s\" is an invalid filename\n", ptr); |
75 | else | 75 | else |
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 2cdc67d1c..a97b3e77b 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -130,6 +130,9 @@ static void chk_chroot(void) { | |||
130 | } | 130 | } |
131 | 131 | ||
132 | int sandbox(void* sandbox_arg) { | 132 | int sandbox(void* sandbox_arg) { |
133 | // Get rid of unused parameter warning | ||
134 | (void)sandbox_arg; | ||
135 | |||
133 | pid_t child_pid = getpid(); | 136 | pid_t child_pid = getpid(); |
134 | if (arg_debug) | 137 | if (arg_debug) |
135 | printf("Initializing child process\n"); | 138 | printf("Initializing child process\n"); |
diff --git a/src/firejail/seccomp.c b/src/firejail/seccomp.c index d00a335c6..c1243cd42 100644 --- a/src/firejail/seccomp.c +++ b/src/firejail/seccomp.c | |||
@@ -337,7 +337,7 @@ static void write_seccomp_file(void) { | |||
337 | printf("Save seccomp filter, size %lu bytes\n", sfilter_index * sizeof(struct sock_filter)); | 337 | printf("Save seccomp filter, size %lu bytes\n", sfilter_index * sizeof(struct sock_filter)); |
338 | errno = 0; | 338 | errno = 0; |
339 | ssize_t sz = write(fd, sfilter, sfilter_index * sizeof(struct sock_filter)); | 339 | ssize_t sz = write(fd, sfilter, sfilter_index * sizeof(struct sock_filter)); |
340 | if (sz != (sfilter_index * sizeof(struct sock_filter))) { | 340 | if (sz != (ssize_t)(sfilter_index * sizeof(struct sock_filter))) { |
341 | fprintf(stderr, "Error: cannot save seccomp filter\n"); | 341 | fprintf(stderr, "Error: cannot save seccomp filter\n"); |
342 | exit(1); | 342 | exit(1); |
343 | } | 343 | } |
diff --git a/src/firejail/util.c b/src/firejail/util.c index 95409129a..29eb101fb 100644 --- a/src/firejail/util.c +++ b/src/firejail/util.c | |||
@@ -391,7 +391,8 @@ void extract_command_name(const char *str) { | |||
391 | 391 | ||
392 | 392 | ||
393 | void update_map(char *mapping, char *map_file) { | 393 | void update_map(char *mapping, char *map_file) { |
394 | int fd, j; | 394 | int fd; |
395 | size_t j; | ||
395 | size_t map_len; /* Length of 'mapping' */ | 396 | size_t map_len; /* Length of 'mapping' */ |
396 | 397 | ||
397 | /* Replace commas in mapping string with newlines */ | 398 | /* Replace commas in mapping string with newlines */ |
@@ -407,7 +408,7 @@ void update_map(char *mapping, char *map_file) { | |||
407 | exit(EXIT_FAILURE); | 408 | exit(EXIT_FAILURE); |
408 | } | 409 | } |
409 | 410 | ||
410 | if (write(fd, mapping, map_len) != map_len) { | 411 | if (write(fd, mapping, map_len) != (ssize_t)map_len) { |
411 | fprintf(stderr, "Error: cannot write to %s: %s\n", map_file, strerror(errno)); | 412 | fprintf(stderr, "Error: cannot write to %s: %s\n", map_file, strerror(errno)); |
412 | exit(EXIT_FAILURE); | 413 | exit(EXIT_FAILURE); |
413 | } | 414 | } |