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/libguess-1.2/src/examples/guessconv/guessconv.c Examining data/libguess-1.2/src/tests/harness.c Examining data/libguess-1.2/src/libguess/libguess.h Examining data/libguess-1.2/src/libguess/dfa.h Examining data/libguess-1.2/src/libguess/dfa.c Examining data/libguess-1.2/src/libguess/guess_tab.c Examining data/libguess-1.2/src/libguess/guess_impl.c Examining data/libguess-1.2/src/libguess/guess.c FINAL RESULTS: data/libguess-1.2/src/examples/guessconv/guessconv.c:202:17: [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 ((r = getopt(argc, argv, "l:i:o:O:v")) != -1) data/libguess-1.2/src/examples/guessconv/guessconv.c:133: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 outbuf[OUTBUF_SIZE]; data/libguess-1.2/src/examples/guessconv/guessconv.c:211:27: [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 ((infile = fopen(optarg, "r")) == NULL) data/libguess-1.2/src/examples/guessconv/guessconv.c:219:28: [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 ((outfile = fopen(optarg, "w")) == NULL) data/libguess-1.2/src/libguess/dfa.h:30:12: [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. signed char (*states)[256]; data/libguess-1.2/src/tests/harness.c:9: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[1024 * 1024]; data/libguess-1.2/src/tests/harness.c:14:10: [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). fp = fopen(argv[1], "r"); data/libguess-1.2/src/examples/guessconv/guessconv.c:79:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t n = read(fd, inptr, maxlen - actlen); data/libguess-1.2/src/examples/guessconv/guessconv.c:108:21: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read (fd, inptr, maxlen - actlen); data/libguess-1.2/src/tests/harness.c:23:34: [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). printf("length = %zu\n", strlen(buf)); data/libguess-1.2/src/tests/harness.c:24:62: [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). printf("jp = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_JP)); data/libguess-1.2/src/tests/harness.c:25:62: [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). printf("tw = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_TW)); data/libguess-1.2/src/tests/harness.c:26:62: [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). printf("cn = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_CN)); data/libguess-1.2/src/tests/harness.c:27:62: [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). printf("kr = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_KR)); data/libguess-1.2/src/tests/harness.c:28:62: [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). printf("ru = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_RU)); data/libguess-1.2/src/tests/harness.c:29:62: [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). printf("ar = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_AR)); data/libguess-1.2/src/tests/harness.c:30:62: [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). printf("tr = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_TR)); data/libguess-1.2/src/tests/harness.c:31:62: [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). printf("gr = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_GR)); data/libguess-1.2/src/tests/harness.c:32:62: [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). printf("hw = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_HW)); data/libguess-1.2/src/tests/harness.c:33:62: [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). printf("pl = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_PL)); data/libguess-1.2/src/tests/harness.c:34:62: [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). printf("bl = %s\n", libguess_determine_encoding(buf, strlen(buf), GUESS_REGION_BL)); ANALYSIS SUMMARY: Hits = 21 Lines analyzed = 2659 in approximately 0.18 seconds (14784 lines/second) Physical Source Lines of Code (SLOC) = 2254 Hits@level = [0] 28 [1] 14 [2] 6 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 49 [1+] 21 [2+] 7 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 21.7391 [1+] 9.31677 [2+] 3.10559 [3+] 0.443656 [4+] 0 [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.