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/mbt-3.6/src/MbtAPI.cxx Examining data/mbt-3.6/src/Pattern.cxx Examining data/mbt-3.6/src/TagLex.cxx Examining data/mbt-3.6/src/Sentence.cxx Examining data/mbt-3.6/src/RunTagger.cxx Examining data/mbt-3.6/src/GenerateTagger.cxx Examining data/mbt-3.6/src/Tagger.cxx Examining data/mbt-3.6/src/convert.cxx Examining data/mbt-3.6/src/Mbt.cxx Examining data/mbt-3.6/src/Mbtg.cxx Examining data/mbt-3.6/src/simpletest.cxx Examining data/mbt-3.6/include/mbt/Logging.h Examining data/mbt-3.6/include/mbt/MbtAPI.h Examining data/mbt-3.6/include/mbt/Pattern.h Examining data/mbt-3.6/include/mbt/Sentence.h Examining data/mbt-3.6/include/mbt/TagLex.h Examining data/mbt-3.6/include/mbt/Tagger.h FINAL RESULTS: data/mbt-3.6/src/simpletest.cxx:36:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char *ev = getenv( "topsrcdir" ); data/mbt-3.6/src/GenerateTagger.cxx:97: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 ( ( lex_file.open( filename, ios::in ), data/mbt-3.6/src/GenerateTagger.cxx:119:20: [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 ( (out_file.open( LexFileName, ios::out ), data/mbt-3.6/src/GenerateTagger.cxx:136:20: [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 ( (out_file.open( MTLexFileName, ios::out ), data/mbt-3.6/src/GenerateTagger.cxx:149:20: [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 ( (out_file.open( TopNFileName, ios::out ), data/mbt-3.6/src/GenerateTagger.cxx:167: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 ( (out_file.open( NpaxFileName, ios::out ), data/mbt-3.6/src/GenerateTagger.cxx:228:15: [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). outfile.open( K_option_name, ios::trunc | ios::out ); data/mbt-3.6/src/GenerateTagger.cxx:234:15: [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). outfile.open( U_option_name, ios::trunc | ios::out ); data/mbt-3.6/src/GenerateTagger.cxx:397: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 ( ( out_file.open( SettingsFileName, ios::out ), data/mbt-3.6/src/RunTagger.cxx:575: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). infile.open(inname, ios::in); data/mbt-3.6/src/RunTagger.cxx:1040: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 SetBuffer[512]; data/mbt-3.6/src/RunTagger.cxx:1041: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 value[512]; data/mbt-3.6/src/Tagger.cxx:339: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 affix[32]; data/mbt-3.6/src/Tagger.cxx:344:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( affix, ".0%1i", FilterThreshold ); data/mbt-3.6/src/Tagger.cxx:347:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( affix, ".%2i", FilterThreshold ); data/mbt-3.6/src/Tagger.cxx:383:7: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( affix, ".top%d", TopNumber ); data/mbt-3.6/src/Tagger.cxx:388:5: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf( affix, ".%dpaxes", Npax ); data/mbt-3.6/include/mbt/Sentence.h:80:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool read( std::istream &, data/mbt-3.6/src/GenerateTagger.cxx:243:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( mySentence.read( infile, input_kind, EosMark, Separators, line_cnt ) ){ data/mbt-3.6/src/RunTagger.cxx:731:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). mySentence.read( ss, input_kind, EosMark, Separators, dummy ); data/mbt-3.6/src/RunTagger.cxx:739:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). mySentence.read( ss, input_kind, EosMark, Separators, dummy ); data/mbt-3.6/src/RunTagger.cxx:975:24: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ( mySentence.read(infile, input_kind, EosMark, Separators, line_cnt ) ){ data/mbt-3.6/src/RunTagger.cxx:1054:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf( SetBuffer, "e %40s", value ); data/mbt-3.6/src/RunTagger.cxx:1059:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"k %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1066:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"l %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1073:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"L %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1080:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"t %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1095:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"r %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1102:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"t %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1109:30: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if ( SetBuffer[1] == ' ' && sscanf(SetBuffer,"E %300s", value ) > 0 ){ data/mbt-3.6/src/RunTagger.cxx:1126:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"T %300s", value ); data/mbt-3.6/src/RunTagger.cxx:1134:2: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. sscanf(SetBuffer,"u %300s", value ); data/mbt-3.6/src/Sentence.cxx:440:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). bool sentence::read( istream &infile, input_kind_type kind, ANALYSIS SUMMARY: Hits = 33 Lines analyzed = 4556 in approximately 0.14 seconds (32480 lines/second) Physical Source Lines of Code (SLOC) = 3605 Hits@level = [0] 1 [1] 16 [2] 16 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 34 [1+] 33 [2+] 17 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 9.43135 [1+] 9.15395 [2+] 4.71567 [3+] 0.277393 [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.