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/tpm2-initramfs-tool-0.2.1/include/tpm2-initramfs-tool.h Examining data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c Examining data/tpm2-initramfs-tool-0.2.1/src/tpm2-initramfs-tool.c Examining data/tpm2-initramfs-tool-0.2.1/test/test-tpm2-initramfs-tool-base32enc.c FINAL RESULTS: data/tpm2-initramfs-tool-0.2.1/include/tpm2-initramfs-tool.h:112:5: [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(stderr, __VA_ARGS__) data/tpm2-initramfs-tool-0.2.1/include/tpm2-initramfs-tool.h:113:18: [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. #define ERR(...) fprintf(stderr, __VA_ARGS__) data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:459:20: [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. int size = snprintf(NULL, 0, TSS2_TCTI_SO_FORMAT, path); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:471:9: [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. snprintf(dlname, size + 1, TSS2_TCTI_SO_FORMAT, path); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:492:15: [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. str = getenv(TPM2_INITRAMFS_TOOL_ENV_TCTI); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:651:17: [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. (c = getopt_long(argc, argv, optstr, long_options, &opt_idx))) { data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:242:9: [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(&(secret)[0], &(data)[0], secretSize); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:259:13: [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(&(secret)[secretSize], &(base32key)[0], base32keySize); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:305: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(&keySensitive.sensitive.data.buffer[0], &(secret)[0], secretSize); data/tpm2-initramfs-tool-0.2.1/src/libtpm2-initramfs-tool.c:239:13: [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(data) > SECRETLEN) ANALYSIS SUMMARY: Hits = 10 Lines analyzed = 976 in approximately 0.03 seconds (29459 lines/second) Physical Source Lines of Code (SLOC) = 655 Hits@level = [0] 5 [1] 1 [2] 3 [3] 2 [4] 4 [5] 0 Hits@level+ = [0+] 15 [1+] 10 [2+] 9 [3+] 6 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 22.9008 [1+] 15.2672 [2+] 13.7405 [3+] 9.16031 [4+] 6.10687 [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.