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/libcotp-1.2.3/src/cotp.h Examining data/libcotp-1.2.3/src/otp.c Examining data/libcotp-1.2.3/tests/test_otp.c FINAL RESULTS: data/libcotp-1.2.3/src/otp.c:144: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 (token, digits_length + 1, fmt, tk); data/libcotp-1.2.3/src/otp.c:60:5: [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 code[6]; data/libcotp-1.2.3/src/otp.c:113:14: [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. unsigned char C_reverse_byte_order[8]; data/libcotp-1.2.3/src/otp.c:141: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 (fmt, "%.", 2); data/libcotp-1.2.3/src/otp.c:143: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 (fmt + 3 + extra_char, "d", 2); data/libcotp-1.2.3/src/otp.c:33:27: [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). char *nK = calloc (1, strlen (K) + 1); data/libcotp-1.2.3/src/otp.c:62:30: [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). int mod = bin_code % strlen(steam_alphabet); data/libcotp-1.2.3/src/otp.c:63:31: [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). bin_code = bin_code / strlen(steam_alphabet); data/libcotp-1.2.3/src/otp.c:104:36: [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). size_t secret_len = (size_t) ((strlen(K) + 1.6 - 1) / 1.6); data/libcotp-1.2.3/src/otp.c:107:57: [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). unsigned char *secret = base32_decode(normalized_K, strlen(normalized_K), &err); data/libcotp-1.2.3/tests/test_otp.c:13:39: [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). char *K_base32 = base32_encode(K, strlen(K)+1, &base_err); data/libcotp-1.2.3/tests/test_otp.c:31:39: [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). char *K_base32 = base32_encode(K, strlen(K)+1, &base_err); data/libcotp-1.2.3/tests/test_otp.c:48:39: [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). char *K_base32 = base32_encode(K, strlen(K)+1, &base_err); data/libcotp-1.2.3/tests/test_otp.c:66:39: [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). char *K_base32 = base32_encode(K, strlen(K)+1, &base_err); data/libcotp-1.2.3/tests/test_otp.c:84:39: [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). char *K_base32 = base32_encode(K, strlen(K)+1, &base_err); data/libcotp-1.2.3/tests/test_otp.c:209:49: [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). char *secret_base32 = base32_encode(secret, strlen(secret)+1, &base_err); ANALYSIS SUMMARY: Hits = 16 Lines analyzed = 604 in approximately 0.03 seconds (18008 lines/second) Physical Source Lines of Code (SLOC) = 460 Hits@level = [0] 3 [1] 11 [2] 4 [3] 0 [4] 1 [5] 0 Hits@level+ = [0+] 19 [1+] 16 [2+] 5 [3+] 1 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 41.3043 [1+] 34.7826 [2+] 10.8696 [3+] 2.17391 [4+] 2.17391 [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.