aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-15 08:47:22 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-15 08:47:22 -0500
commit69be1d0e8657c465f590385b8e7665a9096671f3 (patch)
treef100241391475bab29b4224b28c2a00c31943373 /src
parentfixed sysconfdir (diff)
parentFix warnings by clang-analyzer (scan-build) (diff)
downloadfirejail-69be1d0e8657c465f590385b8e7665a9096671f3.tar.gz
firejail-69be1d0e8657c465f590385b8e7665a9096671f3.tar.zst
firejail-69be1d0e8657c465f590385b8e7665a9096671f3.zip
Merge pull request #134 from reinerh/master
Fix warnings by clang-analyzer (scan-build)
Diffstat (limited to 'src')
-rw-r--r--src/firejail/fs_whitelist.c4
-rw-r--r--src/firejail/util.c2
-rw-r--r--src/lib/libnetlink.c3
3 files changed, 5 insertions, 4 deletions
diff --git a/src/firejail/fs_whitelist.c b/src/firejail/fs_whitelist.c
index 073e247dc..2751a8c71 100644
--- a/src/firejail/fs_whitelist.c
+++ b/src/firejail/fs_whitelist.c
@@ -61,7 +61,7 @@ static void whitelist_path(ProfileEntry *entry) {
61 char *path = entry->data + 10; 61 char *path = entry->data + 10;
62 assert(path); 62 assert(path);
63 const char *fname; 63 const char *fname;
64 char *wfile; 64 char *wfile = NULL;
65 65
66 if (entry->home_dir) { 66 if (entry->home_dir) {
67 fname = path + strlen(cfg.homedir); 67 fname = path + strlen(cfg.homedir);
@@ -86,7 +86,7 @@ static void whitelist_path(ProfileEntry *entry) {
86 86
87 // check if the file exists 87 // check if the file exists
88 struct stat s; 88 struct stat s;
89 if (stat(wfile, &s) == 0) { 89 if (wfile && stat(wfile, &s) == 0) {
90 if (arg_debug) 90 if (arg_debug)
91 printf("Whitelisting %s\n", path); 91 printf("Whitelisting %s\n", path);
92 } 92 }
diff --git a/src/firejail/util.c b/src/firejail/util.c
index d2e6c2799..89d0697fd 100644
--- a/src/firejail/util.c
+++ b/src/firejail/util.c
@@ -258,7 +258,7 @@ char *line_remove_spaces(const char *buf) {
258 } 258 }
259 259
260 // strip last blank character if any 260 // strip last blank character if any
261 if (*(ptr2 - 1) == ' ') 261 if (ptr2 > rv && *(ptr2 - 1) == ' ')
262 --ptr2; 262 --ptr2;
263 *ptr2 = '\0'; 263 *ptr2 = '\0';
264 // if (arg_debug) 264 // if (arg_debug)
diff --git a/src/lib/libnetlink.c b/src/lib/libnetlink.c
index fddbc209d..07457eefe 100644
--- a/src/lib/libnetlink.c
+++ b/src/lib/libnetlink.c
@@ -626,7 +626,8 @@ printf("\tdata length: %d\n", alen);
626 rta = NLMSG_TAIL(n); 626 rta = NLMSG_TAIL(n);
627 rta->rta_type = type; 627 rta->rta_type = type;
628 rta->rta_len = len; 628 rta->rta_len = len;
629 memcpy(RTA_DATA(rta), data, alen); 629 if (data)
630 memcpy(RTA_DATA(rta), data, alen);
630 n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len); 631 n->nlmsg_len = NLMSG_ALIGN(n->nlmsg_len) + RTA_ALIGN(len);
631 return 0; 632 return 0;
632} 633}