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/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c FINAL RESULTS: data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:155:26: [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 H(x) do{if(html)fprintf(stderr,x);}while(0) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:156:15: [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 T(x) fprintf(stderr,x) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1810:6: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(ppat = pat, re); data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:134:9: [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). return atoi(xstr); data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:696: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[256]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1038:9: [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. static char buf[32 * 1024]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1252: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 unit[64]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1256:9: [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. static char pat[32 * 1024]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1257:9: [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. static char patbuf[32 * 1024]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1258:9: [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. static char strbuf[32 * 1024]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1347:19: [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). else if (!(fp = fopen(state.file, "r"))) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1971: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 buf[128]; data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:590:10: [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). len = strlen((char*)u); data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:682:14: [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 (comment[strlen(comment)-1] == '\n') data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1049:8: [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). s += strlen(s); data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1823:18: [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 (nstr != strlen(s)) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1922:29: [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 (nstr >= 0 && nstr != strlen(s)) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:1990:17: [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 (i != (strlen(ans) + 1)) data/golang-rsc-binaryregexp-0.2.0/testdata/testregex.c:2242: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). nexec = nstr >= 0 ? nstr : strlen(s); ANALYSIS SUMMARY: Hits = 19 Lines analyzed = 2286 in approximately 0.09 seconds (24177 lines/second) Physical Source Lines of Code (SLOC) = 2153 Hits@level = [0] 103 [1] 7 [2] 9 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 122 [1+] 19 [2+] 12 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 56.6651 [1+] 8.8249 [2+] 5.57362 [3+] 1.3934 [4+] 1.3934 [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.