From 8cfa7eac96505dfdee8bc1f23d669c539f39d0f6 Mon Sep 17 00:00:00 2001 From: smitsohu Date: Wed, 6 Feb 2019 16:08:38 +0100 Subject: strncmp byte count fixes --- src/faudit/seccomp.c | 4 ++-- src/fbuilder/build_home.c | 4 ++-- src/fbuilder/build_seccomp.c | 4 ++-- src/firejail/profile.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/faudit/seccomp.c b/src/faudit/seccomp.c index 85a883618..5d4ddb329 100644 --- a/src/faudit/seccomp.c +++ b/src/faudit/seccomp.c @@ -27,8 +27,8 @@ static int extract_seccomp(int *val) { char buf[MAXBUF]; while (fgets(buf, MAXBUF, fp)) { - if (strncmp(buf, "Seccomp:\t", 8) == 0) { - char *ptr = buf + 8; + if (strncmp(buf, "Seccomp:\t", 9) == 0) { + char *ptr = buf + 9; int tmp; sscanf(ptr, "%d", &tmp); *val = tmp; diff --git a/src/fbuilder/build_home.c b/src/fbuilder/build_home.c index 7470a8d10..1a2307910 100644 --- a/src/fbuilder/build_home.c +++ b/src/fbuilder/build_home.c @@ -111,7 +111,7 @@ void process_home(const char *fname, char *home, int home_len) { // skip files handled automatically by firejail if (strcmp(ptr, ".Xauthority") == 0 || strcmp(ptr, ".Xdefaults-debian") == 0 || - strncmp(ptr, ".config/pulse/", 13) == 0 || + strncmp(ptr, ".config/pulse/", 14) == 0 || strncmp(ptr, ".pulse/", 7) == 0 || strncmp(ptr, ".bash_hist", 10) == 0 || strcmp(ptr, ".bashrc") == 0) @@ -196,4 +196,4 @@ void build_home(const char *fname, FILE *fp) { else fprintf(fp, "private\n"); -} \ No newline at end of file +} diff --git a/src/fbuilder/build_seccomp.c b/src/fbuilder/build_seccomp.c index fbc0e06f4..b1f41a6c7 100644 --- a/src/fbuilder/build_seccomp.c +++ b/src/fbuilder/build_seccomp.c @@ -131,9 +131,9 @@ static void process_protocol(const char *fname) { inet = 1; else if (strncmp(ptr, "AF_INET6 ", 9) == 0) inet6 = 1; - else if (strncmp(ptr, "AF_NETLINK ", 9) == 0) + else if (strncmp(ptr, "AF_NETLINK ", 11) == 0) netlink = 1; - else if (strncmp(ptr, "AF_PACKET ", 9) == 0) + else if (strncmp(ptr, "AF_PACKET ", 10) == 0) packet = 1; } diff --git a/src/firejail/profile.c b/src/firejail/profile.c index bc66aca78..af7b54596 100644 --- a/src/firejail/profile.c +++ b/src/firejail/profile.c @@ -869,7 +869,7 @@ int profile_check_line(char *ptr, int lineno, const char *fname) { } // nice value - if (strncmp(ptr, "nice ", 4) == 0) { + if (strncmp(ptr, "nice ", 5) == 0) { cfg.nice = atoi(ptr + 5); if (getuid() != 0 &&cfg.nice < 0) cfg.nice = 0; -- cgit v1.2.3-54-g00ecf