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/apertium-lex-tools-0.2.3/src/biltrans-without-queue.cpp Examining data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp Examining data/apertium-lex-tools-0.2.3/src/irstlm_ranker.h Examining data/apertium-lex-tools-0.2.3/src/ldx_proc.cc Examining data/apertium-lex-tools-0.2.3/src/lrx_comp.cc Examining data/apertium-lex-tools-0.2.3/src/lrx_compiler.h Examining data/apertium-lex-tools-0.2.3/src/lrx_proc.cc Examining data/apertium-lex-tools-0.2.3/src/lrx_processor.h Examining data/apertium-lex-tools-0.2.3/src/multi_translator.cc Examining data/apertium-lex-tools-0.2.3/src/multi_translator.h Examining data/apertium-lex-tools-0.2.3/src/multitrans.cc Examining data/apertium-lex-tools-0.2.3/src/tagger_output_processor.cc Examining data/apertium-lex-tools-0.2.3/src/tagger_output_processor.h Examining data/apertium-lex-tools-0.2.3/src/yasmet.cc Examining data/apertium-lex-tools-0.2.3/src/lrx_compiler.cc Examining data/apertium-lex-tools-0.2.3/src/lrx_processor.cc FINAL RESULTS: data/apertium-lex-tools-0.2.3/src/lrx_compiler.cc:56:3: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 50, L"%d", i); data/apertium-lex-tools-0.2.3/src/lrx_processor.cc:32:3: [4] (format) swprintf: Potential format string problem (CWE-134). Make format string constant. swprintf(buf, 50, L"%d", i); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:66:13: [3] (buffer) getopt_long: 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. int c = getopt_long(argc, argv, "mztd", long_options, &option_index); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:68:13: [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. int c = getopt(argc, argv, "mztd"); data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp:16:10: [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). tmtrans.open(tmtrans_path); data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp:134:9: [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). fb->open(filePath.c_str(), std::ios::in); data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp:238:22: [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). lineno = atoi(tokens[0].c_str()); data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp:239:28: [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). int current_sublineno = atoi(tokens[1].c_str()); data/apertium-lex-tools-0.2.3/src/irstlm_ranker.cpp:283:22: [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). lineno = atoi(tokens[0].c_str()); data/apertium-lex-tools-0.2.3/src/ldx_proc.cc:242: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 *t_rl = fopen(argv[1], "r"); data/apertium-lex-tools-0.2.3/src/lrx_comp.cc:44:20: [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 *output = fopen(argv[2], "wb"); data/apertium-lex-tools-0.2.3/src/lrx_comp.cc:60:20: [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 *output = fopen(argv[3], "wb"); data/apertium-lex-tools-0.2.3/src/lrx_compiler.cc:54:3: [2] (buffer) wchar_t: 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. wchar_t buf[50]; data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:100: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 *in = fopen(argv[optind], "rb"); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:106:13: [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). input = fopen(argv[optind+1], "rb"); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:112:13: [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). output= fopen(argv[optind+2], "wb"); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:123: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 *in = fopen(argv[optind], "rb"); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:129:13: [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). input = fopen(argv[optind+1], "rb"); data/apertium-lex-tools-0.2.3/src/lrx_proc.cc:140: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 *in = fopen(argv[optind], "rb"); data/apertium-lex-tools-0.2.3/src/lrx_processor.cc:30:3: [2] (buffer) wchar_t: 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. wchar_t buf[50]; data/apertium-lex-tools-0.2.3/src/multi_translator.cc:11: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 *f_bin = fopen(path.c_str(), "rb"); data/apertium-lex-tools-0.2.3/src/yasmet.cc:104:32: [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). else if (si == "-red") mfc = atoi(argv[++i]); data/apertium-lex-tools-0.2.3/src/yasmet.cc:105:35: [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). else if (si == "-iter") maxIt = atoi(argv[++i]); data/apertium-lex-tools-0.2.3/src/yasmet.cc:163:10: [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). C = atoi(s.c_str()); data/apertium-lex-tools-0.2.3/src/yasmet.cc:174:13: [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). e.y = atoi(s.c_str()); data/apertium-lex-tools-0.2.3/src/ldx_proc.cc:317:40: [1] (buffer) wcslen: 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). wstring to = t.substr(1, wcslen(t.c_str())-2); data/apertium-lex-tools-0.2.3/src/lrx_processor.cc:78:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). alphabet.read(in); data/apertium-lex-tools-0.2.3/src/lrx_processor.cc:91:23: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). recognisers[name].read(in, alphabet); data/apertium-lex-tools-0.2.3/src/lrx_processor.cc:109:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). transducer.read(in, alphabet); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 4567 in approximately 0.12 seconds (39511 lines/second) Physical Source Lines of Code (SLOC) = 3710 Hits@level = [0] 102 [1] 4 [2] 21 [3] 2 [4] 2 [5] 0 Hits@level+ = [0+] 131 [1+] 29 [2+] 25 [3+] 4 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 35.31 [1+] 7.81671 [2+] 6.73854 [3+] 1.07817 [4+] 0.539084 [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.