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/since-1.1/since.c FINAL RESULTS: data/since-1.1/since.c:331:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(tmp, path); data/since-1.1/since.c:333:5: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(tmp + plen + 1, append); data/since-1.1/since.c:823:14: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. result = snprintf(line, MAX_FMT, sn->s_fmt, df->d_dev, df->d_ino, 0); data/since-1.1/since.c:1504:16: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. result = snprintf(target, sn->s_fmt_output + 1, sn->s_fmt, df->d_dev, df->d_ino, df->d_pos); data/since-1.1/since.c:168:6: [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. if(realpath(sn->s_name, canon) == NULL){ data/since-1.1/since.c:388: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. ptr = getenv("SINCE"); data/since-1.1/since.c:393: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. ptr = getenv("HOME"); data/since-1.1/since.c:85:3: [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 s_fmt[MAX_FMT]; data/since-1.1/since.c:165:3: [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 canon[PATH_MAX], tmp[PATH_MAX], *tptr; data/since-1.1/since.c:189:9: [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). nfd = open(tmp, flags, mode); data/since-1.1/since.c:351:14: [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). sn->s_fd = open(sn->s_name, flags, mode); data/since-1.1/since.c:558:3: [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[MAX_FMT], *ptr; data/since-1.1/since.c:602:7: [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(line + k, ptr, end[x]); data/since-1.1/since.c:759:8: [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). fd = open(name, O_RDONLY); data/since-1.1/since.c:812:3: [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[MAX_FMT], *end; data/since-1.1/since.c:980:3: [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 discard[PATH_MAX]; data/since-1.1/since.c:1243:3: [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 buffer[IO_BUFFER]; data/since-1.1/since.c:1622:32: [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). sn->s_delay.tv_sec = atoi(argv[i] + j); data/since-1.1/since.c:321:12: [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). plen = strlen(path); data/since-1.1/since.c:322:12: [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). alen = strlen(append); data/since-1.1/since.c:476:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rr = read(sn->s_fd, sn->s_buffer + rt, sn->s_size - rt); data/since-1.1/since.c:992:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read(sn->s_notify, &update, sizeof(struct inotify_event)); data/since-1.1/since.c:1015:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). result = read(sn->s_notify, discard, update.len); data/since-1.1/since.c:1304:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rr = read(df->d_fd, buffer, IO_BUFFER); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 1778 in approximately 0.08 seconds (22051 lines/second) Physical Source Lines of Code (SLOC) = 1447 Hits@level = [0] 125 [1] 6 [2] 11 [3] 3 [4] 4 [5] 0 Hits@level+ = [0+] 149 [1+] 24 [2+] 18 [3+] 7 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 102.972 [1+] 16.586 [2+] 12.4395 [3+] 4.8376 [4+] 2.76434 [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.