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/grepcidr-2.0/grepcidr.c FINAL RESULTS: data/grepcidr-2.0/grepcidr.c:395:6: [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, TXT_BADPAT ": %s", line); data/grepcidr-2.0/grepcidr.c:417: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, TXT_BADPAT ": %s\n", token); data/grepcidr-2.0/grepcidr.c:513:4: [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, TXT_MEMORY); data/grepcidr-2.0/grepcidr.c:527:4: [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, TXT_MEMORY); data/grepcidr-2.0/grepcidr.c:586:3: [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, TXT_FATAL); data/grepcidr-2.0/grepcidr.c:592:3: [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, TXT_USAGE); data/grepcidr-2.0/grepcidr.c:631: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, TXT_USAGE); data/grepcidr-2.0/grepcidr.c:642:4: [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, TXT_USAGE2); data/grepcidr-2.0/grepcidr.c:654:3: [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, TXT_MEMORY); data/grepcidr-2.0/grepcidr.c:596:21: [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 ((foundopt = getopt(argc, argv, shortopts)) != -1) data/grepcidr-2.0/grepcidr.c:70:11: [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 min[16]; data/grepcidr-2.0/grepcidr.c:71:11: [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 max[16]; data/grepcidr-2.0/grepcidr.c:148:11: [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 parsed[4] = { 0 }; data/grepcidr-2.0/grepcidr.c:149: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 buf[IPV4_BUFSIZE]; data/grepcidr-2.0/grepcidr.c:152: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(buf, p, len); data/grepcidr-2.0/grepcidr.c:171: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 buf[IPV6_BUFSIZE]; data/grepcidr-2.0/grepcidr.c:174: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(buf, p, len); data/grepcidr-2.0/grepcidr.c:259:11: [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 address[16] = { 0 }; data/grepcidr-2.0/grepcidr.c:265: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(v6spec->min, address, 16); data/grepcidr-2.0/grepcidr.c:266: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(v6spec->max, address, 16); data/grepcidr-2.0/grepcidr.c:380:16: [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* data = fopen(pat_filename, "r"); data/grepcidr-2.0/grepcidr.c:383:4: [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 line[MAXFIELD]; data/grepcidr-2.0/grepcidr.c:670:17: [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). inp_stream = fopen(curfilename, "r"); data/grepcidr-2.0/grepcidr.c:519:25: [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 len = bufcur + strlen(*bufptr + bufcur); ANALYSIS SUMMARY: Hits = 24 Lines analyzed = 694 in approximately 0.04 seconds (16665 lines/second) Physical Source Lines of Code (SLOC) = 528 Hits@level = [0] 8 [1] 1 [2] 13 [3] 1 [4] 9 [5] 0 Hits@level+ = [0+] 32 [1+] 24 [2+] 23 [3+] 10 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 60.6061 [1+] 45.4545 [2+] 43.5606 [3+] 18.9394 [4+] 17.0455 [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.