Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/libdaemon-0.14/examples/testd.c Examining data/libdaemon-0.14/libdaemon/dlog.h Examining data/libdaemon-0.14/libdaemon/dpid.h Examining data/libdaemon-0.14/libdaemon/dnonblock.h Examining data/libdaemon-0.14/libdaemon/dlog.c Examining data/libdaemon-0.14/libdaemon/dexec.h Examining data/libdaemon-0.14/libdaemon/dexec.c Examining data/libdaemon-0.14/libdaemon/daemon.h Examining data/libdaemon-0.14/libdaemon/dsignal.c Examining data/libdaemon-0.14/libdaemon/dfork.h Examining data/libdaemon-0.14/libdaemon/dpid.c Examining data/libdaemon-0.14/libdaemon/dnonblock.c Examining data/libdaemon-0.14/libdaemon/dfork.c Examining data/libdaemon-0.14/libdaemon/dsignal.h FINAL RESULTS: data/libdaemon-0.14/libdaemon/dexec.c:118:9: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv(prog, args); data/libdaemon-0.14/libdaemon/dlog.c:60:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, template, arglist); data/libdaemon-0.14/libdaemon/dlog.c:65:9: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stdout, template, arglist); data/libdaemon-0.14/libdaemon/dlog.h:56:61: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define DAEMON_GCC_PRINTF_ATTR(a,b) __attribute__ ((format (printf, a, b))) data/libdaemon-0.14/libdaemon/dexec.c:50:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char buf[256]; data/libdaemon-0.14/libdaemon/dexec.c:73:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char *args[MAX_ARGS]; data/libdaemon-0.14/libdaemon/dexec.c:97:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if (open("/dev/null", O_RDONLY) != 0) { data/libdaemon-0.14/libdaemon/dfork.c:58:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd2 = open("/dev/null", f)) < 0) data/libdaemon-0.14/libdaemon/dpid.c:62:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char fn[PATH_MAX]; data/libdaemon-0.14/libdaemon/dpid.c:96:12: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. static char txt[256]; data/libdaemon-0.14/libdaemon/dpid.c:108:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_RDWR, 0644)) < 0) { data/libdaemon-0.14/libdaemon/dpid.c:109:19: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_RDONLY, 0644)) < 0) { data/libdaemon-0.14/libdaemon/dpid.c:214:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char t[64]; data/libdaemon-0.14/libdaemon/dpid.c:225:15: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((fd = open(fn, O_CREAT|O_RDWR|O_EXCL, 0644)) < 0) { data/libdaemon-0.14/libdaemon/dexec.c:106:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0022); /* Set up a sane umask */ data/libdaemon-0.14/libdaemon/dexec.c:155:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(p[0], &c, 1) != 1) data/libdaemon-0.14/libdaemon/dfork.c:77:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((r = read(fd, d, l)) <= 0) { data/libdaemon-0.14/libdaemon/dfork.c:238:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(0077); data/libdaemon-0.14/libdaemon/dpid.c:120:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((l = read(fd, txt, sizeof(txt)-1)) < 0) { data/libdaemon-0.14/libdaemon/dpid.c:218:9: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). u = umask(022); data/libdaemon-0.14/libdaemon/dpid.c:239:9: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). l = strlen(t); data/libdaemon-0.14/libdaemon/dpid.c:262:5: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(u); data/libdaemon-0.14/libdaemon/dsignal.c:136:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((r = read(_signal_pipe[0], &s, sizeof(s))) == sizeof(s)) ANALYSIS SUMMARY: Hits = 23 Lines analyzed = 2316 in approximately 0.10 seconds (23318 lines/second) Physical Source Lines of Code (SLOC) = 1259 Hits@level = [0] 4 [1] 9 [2] 10 [3] 0 [4] 4 [5] 0 Hits@level+ = [0+] 27 [1+] 23 [2+] 14 [3+] 4 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 21.4456 [1+] 18.2685 [2+] 11.1199 [3+] 3.17712 [4+] 3.17712 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.