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/seccure-0.5/numtheory.h Examining data/seccure-0.5/ecc.h Examining data/seccure-0.5/serialize.h Examining data/seccure-0.5/protocol.h Examining data/seccure-0.5/aes256ctr.h Examining data/seccure-0.5/curves.c Examining data/seccure-0.5/ecc.c Examining data/seccure-0.5/numtheory.c Examining data/seccure-0.5/seccure.c Examining data/seccure-0.5/curves.h Examining data/seccure-0.5/aes256ctr.c Examining data/seccure-0.5/protocol.c Examining data/seccure-0.5/serialize.c FINAL RESULTS: data/seccure-0.5/seccure.c:270:7: [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, ANSI_CLEAR_LINE); data/seccure-0.5/seccure.c:283:2: [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, ANSI_CLEAR_LINE); data/seccure-0.5/seccure.c:320:7: [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, VERSION "\n"); data/seccure-0.5/seccure.c:365: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, VERSION "\n"); data/seccure-0.5/seccure.c:461:7: [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, VERSION "\n"); data/seccure-0.5/seccure.c:578:7: [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, VERSION "\n"); data/seccure-0.5/seccure.c:679: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, VERSION "\n"); data/seccure-0.5/seccure.c:808: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, VERSION "\n"); data/seccure-0.5/seccure.c:914: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, VERSION "\n"); data/seccure-0.5/seccure.c:1032:7: [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, VERSION "\n"); data/seccure-0.5/seccure.c:1138:14: [3] (buffer) getopt: 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. while((i = getopt(argc, argv, "fbadm:i:o:F:s:c:hvq")) != -1) data/seccure-0.5/aes256ctr.h:50: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 buf[CIPHER_BLOCK_SIZE]; data/seccure-0.5/seccure.c:170: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 buf[COPYBUF_SIZE]; data/seccure-0.5/seccure.c:188: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 buf[COPYBUF_SIZE]; data/seccure-0.5/seccure.c:203:3: [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(tail, buf, taillen); data/seccure-0.5/seccure.c:209: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 buf[COPYBUF_SIZE]; data/seccure-0.5/seccure.c:221:3: [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(tail, buf, taillen); data/seccure-0.5/seccure.c:252:3: [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(hash, md, 32); data/seccure-0.5/seccure.c:313: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 pubkey[MAX_PK_LEN_COMPACT + 1]; data/seccure-0.5/seccure.c:376: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 rbuf[MAX_PK_LEN_BIN]; data/seccure-0.5/seccure.c:453: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 rbuf[MAX_PK_LEN_BIN]; data/seccure-0.5/seccure.c:454: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 mdbuf[MAX_MACLEN], *md; data/seccure-0.5/seccure.c:614:24: [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). if (! (sigfile = fopen(opt_sigfile, "w"))) data/seccure-0.5/seccure.c:621:7: [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 sigbuf[MAX_SIG_LEN_BIN]; data/seccure-0.5/seccure.c:630:7: [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 sigbuf[MAX_SIG_LEN_COMPACT + 1]; data/seccure-0.5/seccure.c:689:7: [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 compact[MAX_SIG_LEN_COMPACT + 2]; data/seccure-0.5/seccure.c:690:7: [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 bin[MAX_SIG_LEN_BIN]; data/seccure-0.5/seccure.c:699:24: [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). if (! (sigfile = fopen(opt_sigfile, "r"))) data/seccure-0.5/seccure.c:819: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 rbuf[MAX_PK_LEN_BIN]; data/seccure-0.5/seccure.c:820: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 sigbuf[MAX_SIG_LEN_BIN]; data/seccure-0.5/seccure.c:925: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 rbuf[MAX_PK_LEN_BIN]; data/seccure-0.5/seccure.c:926: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 sigbuf[MAX_SIG_LEN_BIN]; data/seccure-0.5/seccure.c:1024: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 keyA[MAX_PK_LEN_COMPACT + 1]; data/seccure-0.5/seccure.c:1025: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 keyB[MAX_PK_LEN_COMPACT + 2]; data/seccure-0.5/seccure.c:1145:20: [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). opt_maclen = atoi(optarg); data/seccure-0.5/seccure.c:1168:21: [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). if ((opt_fdin = open(opt_infile, O_RDONLY)) < 0) data/seccure-0.5/seccure.c:1173:22: [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). if ((opt_fdout = open(opt_outfile, O_WRONLY | O_CREAT | O_TRUNC, data/seccure-0.5/seccure.c:1179:21: [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). if ((opt_fdpw = open(opt_pwfile, O_RDONLY)) < 0) data/seccure-0.5/seccure.c:1184:23: [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). if ((opt_fdpw = open("/dev/tty", O_RDONLY)) < 0) data/seccure-0.5/serialize.c:46:7: [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. const char compact_digits[COMPACT_DIGITS_COUNT] = { data/seccure-0.5/protocol.c:115:33: [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). assert(! (df == DF_COMPACT && strlen(buf) != inlen)); data/seccure-0.5/seccure.c:157:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = read(fd, buf, len)) < 0) data/seccure-0.5/seccure.c:172:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = read(fdin, buf, COPYBUF_SIZE)) > 0) { data/seccure-0.5/seccure.c:192:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = read(fdin, buf + taillen, COPYBUF_SIZE - taillen)) > 0) { data/seccure-0.5/seccure.c:213:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c = read(fdin, buf + taillen, COPYBUF_SIZE - taillen)) > 0) { data/seccure-0.5/seccure.c:240:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (((r = read(opt_fdpw, &ch, 1)) > 0) && (ch != '\n')) data/seccure-0.5/seccure.c:360:41: [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 (! (cp = curve_by_pk_len_compact(strlen(pubkey)))) data/seccure-0.5/seccure.c:372:7: [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(pubkey) != cp->pk_len_compact) data/seccure-0.5/seccure.c:674:41: [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 (! (cp = curve_by_pk_len_compact(strlen(pubkey)))) data/seccure-0.5/seccure.c:684:7: [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(pubkey) != cp->pk_len_compact) data/seccure-0.5/seccure.c:755:11: [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(sig) != cp->sig_len_compact) { data/seccure-0.5/seccure.c:803:45: [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 (! (cp_enc = curve_by_pk_len_compact(strlen(pubkey)))) data/seccure-0.5/seccure.c:815:7: [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(pubkey) != cp_enc->pk_len_compact) data/seccure-0.5/seccure.c:909:45: [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 (! (cp_sig = curve_by_pk_len_compact(strlen(pubkey)))) data/seccure-0.5/seccure.c:921:7: [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(pubkey) != cp_sig->pk_len_compact) data/seccure-0.5/seccure.c:1050:9: [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(keyB) != cp->pk_len_compact) ANALYSIS SUMMARY: Hits = 56 Lines analyzed = 3083 in approximately 0.10 seconds (31008 lines/second) Physical Source Lines of Code (SLOC) = 2236 Hits@level = [0] 73 [1] 16 [2] 29 [3] 1 [4] 10 [5] 0 Hits@level+ = [0+] 129 [1+] 56 [2+] 40 [3+] 11 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 57.6923 [1+] 25.0447 [2+] 17.8891 [3+] 4.9195 [4+] 4.47227 [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.