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/btfs-2.22/src/btfs.cc Examining data/btfs-2.22/src/btfs.h Examining data/btfs-2.22/src/btfsstat.cc Examining data/btfs-2.22/src/btfsstat.h FINAL RESULTS: data/btfs-2.22/src/btfs.cc:990:3: [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. printf(PACKAGE " version: " VERSION "\n"); data/btfs-2.22/src/btfs.cc:771:13: [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. } else if (getenv("HOME")) { data/btfs-2.22/src/btfs.cc:772:12: [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. templ += getenv("HOME"); data/btfs-2.22/src/btfs.cc:788:13: [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. char *x = realpath(s, NULL); data/btfs-2.22/src/btfs.cc:877:13: [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. char *r = realpath(uri.c_str(), NULL); data/btfs-2.22/src/btfsstat.cc:104:16: [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. char *root = realpath(argv[i], NULL); data/btfs-2.22/src/btfs.cc:147:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. i->filled = (memcpy(i->buf, buffer + i->part.start, data/btfs-2.22/src/btfs.cc:721:2: [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(data, xattrs, (size_t) xattrslen); data/btfs-2.22/src/btfs.cc:735: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 xattr[16]; data/btfs-2.22/src/btfs.cc:760:2: [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(value, xattr + position, (size_t) xattrlen - position); data/btfs-2.22/src/btfs.cc:814:2: [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(output->buf + off, contents, nmemb * size); data/btfs-2.22/src/btfs.h:106: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("/dev/null"); data/btfs-2.22/src/btfs.cc:178:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int Read::read() { data/btfs-2.22/src/btfs.cc:220:8: [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). if (strlen(x) <= 0) data/btfs-2.22/src/btfs.cc:523:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int s = r->read(); data/btfs-2.22/src/btfs.h:73:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int read(); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 1336 in approximately 0.05 seconds (24953 lines/second) Physical Source Lines of Code (SLOC) = 959 Hits@level = [0] 29 [1] 4 [2] 6 [3] 5 [4] 1 [5] 0 Hits@level+ = [0+] 45 [1+] 16 [2+] 12 [3+] 6 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 46.9239 [1+] 16.684 [2+] 12.513 [3+] 6.25652 [4+] 1.04275 [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.