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/luksmeta-9/luksmeta.h Examining data/luksmeta-9/crc32c.c Examining data/luksmeta-9/crc32c.h Examining data/luksmeta-9/libluksmeta.c Examining data/luksmeta-9/test.h Examining data/luksmeta-9/luksmeta.c Examining data/luksmeta-9/test-crc32c.c Examining data/luksmeta-9/test-lm-init.c Examining data/luksmeta-9/test-lm-big.c Examining data/luksmeta-9/test-lm-one.c Examining data/luksmeta-9/test-lm-two.c Examining data/luksmeta-9/test-lm-assumptions.c Examining data/luksmeta-9/test.c FINAL RESULTS: data/luksmeta-9/luksmeta.c:189:17: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, UUID_TMPL "\n", UUID_ARGS(uuid)); data/luksmeta-9/luksmeta.c:448:17: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(optarg, UUID_TMPL, UUID_ARGS(&o.uuid)) != 16) { data/luksmeta-9/luksmeta.c:441:22: [3] (buffer) getopt_long: 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. for (int c; (c = getopt_long(argc, argv, sopts, lopts, NULL)) != -1; ) { data/luksmeta-9/libluksmeta.c:195: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). fd = open(name, flags); data/luksmeta-9/libluksmeta.c:277:5: [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(lm.magic, LM_MAGIC, sizeof(LM_MAGIC)); data/luksmeta-9/libluksmeta.c:383:5: [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(uuid, s->uuid, sizeof(luksmeta_uuid_t)); data/luksmeta-9/libluksmeta.c:427:5: [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(s->uuid, uuid, sizeof(luksmeta_uuid_t)); data/luksmeta-9/test-lm-init.c:90: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). fd = open(filename, O_RDWR | O_SYNC); data/luksmeta-9/test.c:69:12: [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(filename, "r"); data/luksmeta-9/test.c:133:10: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(filename); data/luksmeta-9/libluksmeta.c:119:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). r = read(fd, &tmp[t], size - t); data/luksmeta-9/luksmeta.c:69:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(stdin); data/luksmeta-9/luksmeta.c:105:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(stdin); data/luksmeta-9/luksmeta.c:361:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(stdin); ANALYSIS SUMMARY: Hits = 14 Lines analyzed = 2010 in approximately 0.10 seconds (20332 lines/second) Physical Source Lines of Code (SLOC) = 1361 Hits@level = [0] 58 [1] 4 [2] 7 [3] 1 [4] 2 [5] 0 Hits@level+ = [0+] 72 [1+] 14 [2+] 10 [3+] 3 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 52.9023 [1+] 10.2866 [2+] 7.34754 [3+] 2.20426 [4+] 1.46951 [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.