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/entr-4.6/data.h Examining data/entr-4.6/entr.c Examining data/entr-4.6/entr_spec.c Examining data/entr-4.6/missing/fmemopen.c Examining data/entr-4.6/missing/kqueue_inotify.c Examining data/entr-4.6/missing/strlcpy.c Examining data/entr-4.6/missing/sys/event.h Examining data/entr-4.6/missing/compat.h FINAL RESULTS: data/entr-4.6/entr.c:123:12: [4] (shell) execvp: 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. xexecvp = execvp; data/entr-4.6/entr.c:449:4: [4] (shell) system: 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. system("/usr/bin/clear"); data/entr-4.6/entr.c:127:14: [3] (buffer) realpath: This function does not protect against buffer overflows, and some implementations can overflow internally (CWE-120/CWE-785!). Ensure that the destination buffer is at least of size MAXPATHLEN, andto protect against implementation problems, the input argument should also be checked to ensure it is no larger than MAXPATHLEN. xrealpath = realpath; data/entr-4.6/entr.c:261:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. basename(getenv("SHELL")), WEXITSTATUS(status)); data/entr-4.6/entr.c:353:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((ch = getopt(argc, argv, "acdnprsz")) != -1) { data/entr-4.6/entr.c:419:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. new_argv[0] = getenv("SHELL"); data/entr-4.6/entr.c:471:17: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. basename(getenv("SHELL")), WEXITSTATUS(status)); data/entr-4.6/entr.c:684:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("EV_TRACE")) { data/entr-4.6/missing/kqueue_inotify.c:90:6: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("ENTR_INOTIFY_WORKAROUND")) data/entr-4.6/missing/kqueue_inotify.c:143:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("ENTR_INOTIFY_WORKAROUND")) data/entr-4.6/missing/kqueue_inotify.c:192:9: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv("ENTR_INOTIFY_WORKAROUND")) data/entr-4.6/data.h:24:2: [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 fn[PATH_MAX]; data/entr-4.6/entr.c:126:10: [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). xopen = open; data/entr-4.6/entr.c:277:2: [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 buf[PATH_MAX]; data/entr-4.6/entr_spec.c:49:4: [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). } open; data/entr-4.6/entr_spec.c:169:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&ctx.event.Set[ctx.event.nset], changelist, data/entr-4.6/entr_spec.c:176:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(eventlist, &ctx.event.List, data/entr-4.6/entr_spec.c:205:6: [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). ctx.open.path = path; data/entr-4.6/entr_spec.c:206:6: [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). ctx.open.fd++; data/entr-4.6/entr_spec.c:207: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). return ctx.open.fd; data/entr-4.6/missing/kqueue_inotify.c:59:2: [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 line[8]; data/entr-4.6/missing/kqueue_inotify.c:64:10: [2] (misc) fopen: 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). file = fopen("/proc/sys/fs/inotify/max_user_watches", "r"); data/entr-4.6/missing/kqueue_inotify.c:68:11: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). value = atoi(line); data/entr-4.6/missing/kqueue_inotify.c:106:2: [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 buf[EVENT_BUF_LEN]; data/entr-4.6/entr.c:434:10: [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). p += strlen(xrealpath(leading_edge->fn, p)); data/entr-4.6/entr.c:596:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(STDIN_FILENO, &c, 1) < 1) { data/entr-4.6/entr_spec.c:231:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/entr_spec.c:249:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/entr_spec.c:268:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/entr_spec.c:294:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/entr_spec.c:882:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/entr_spec.c:904:25: [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). fake = fmemopen(input, strlen(input), "r"); data/entr-4.6/missing/kqueue_inotify.c:173:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). len = read(kq /* ifd */, &buf, EVENT_BUF_LEN); ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 2289 in approximately 0.08 seconds (27442 lines/second) Physical Source Lines of Code (SLOC) = 1631 Hits@level = [0] 8 [1] 9 [2] 13 [3] 9 [4] 2 [5] 0 Hits@level+ = [0+] 41 [1+] 33 [2+] 24 [3+] 11 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 25.138 [1+] 20.233 [2+] 14.7149 [3+] 6.74433 [4+] 1.22624 [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.