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/sfst-1.4.7b/src/fst-train.C Examining data/sfst-1.4.7b/src/fst-infl3.C Examining data/sfst-1.4.7b/src/basic.h Examining data/sfst-1.4.7b/src/operators.C Examining data/sfst-1.4.7b/src/utf8.C Examining data/sfst-1.4.7b/src/fst-infl.C Examining data/sfst-1.4.7b/src/compact.C Examining data/sfst-1.4.7b/src/fst-infl2-daemon.C Examining data/sfst-1.4.7b/src/alphabet.h Examining data/sfst-1.4.7b/src/fst-generate.C Examining data/sfst-1.4.7b/src/fst.C Examining data/sfst-1.4.7b/src/fst-text2bin.C Examining data/sfst-1.4.7b/src/interface.h Examining data/sfst-1.4.7b/src/fst-infl2.C Examining data/sfst-1.4.7b/src/fst-match.C Examining data/sfst-1.4.7b/src/utf8-scanner.C Examining data/sfst-1.4.7b/src/make-compact.h Examining data/sfst-1.4.7b/src/interface.C Examining data/sfst-1.4.7b/src/compact.h Examining data/sfst-1.4.7b/src/fst-compiler.C Examining data/sfst-1.4.7b/src/make-compact.C Examining data/sfst-1.4.7b/src/sgi.h Examining data/sfst-1.4.7b/src/lowmem.h Examining data/sfst-1.4.7b/src/fst-parse2.C Examining data/sfst-1.4.7b/src/alphabet.C Examining data/sfst-1.4.7b/src/fst.h Examining data/sfst-1.4.7b/src/fst-lowmem.C Examining data/sfst-1.4.7b/src/fst-compare.C Examining data/sfst-1.4.7b/src/basic.C Examining data/sfst-1.4.7b/src/fst-compact.C Examining data/sfst-1.4.7b/src/fst-mor.C Examining data/sfst-1.4.7b/src/utf8.h Examining data/sfst-1.4.7b/src/test.C Examining data/sfst-1.4.7b/src/robust.C Examining data/sfst-1.4.7b/src/fst-print.C Examining data/sfst-1.4.7b/src/mem.h Examining data/sfst-1.4.7b/src/lowmem.C Examining data/sfst-1.4.7b/src/hopcroft.C Examining data/sfst-1.4.7b/src/fst-parse.C Examining data/sfst-1.4.7b/src/fst-lattice.C Examining data/sfst-1.4.7b/src/fst-compiler.h Examining data/sfst-1.4.7b/src/Socket.h Examining data/sfst-1.4.7b/src/generate.C Examining data/sfst-1.4.7b/src/determinise.C Examining data/sfst-1.4.7b/src/scanner.h Examining data/sfst-1.4.7b/src/default-scanner.C FINAL RESULTS: data/sfst-1.4.7b/src/alphabet.C:224:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(message, "Error: reinserting symbol '%s' in alphabet with incompatible character value %u %u", symbol, (unsigned)sc, (unsigned)c); data/sfst-1.4.7b/src/alphabet.C:239:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(message,"Error: defining symbol %s as character %d (previously defined as %s)", symbol, (unsigned)c, s); data/sfst-1.4.7b/src/alphabet.C:569:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer,"Error: incomplete symbol in input file: %s", string); data/sfst-1.4.7b/src/basic.C:37:5: [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(pStringCopy, pString); data/sfst-1.4.7b/src/fst-compiler.C:955:21: [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 YYFPRINTF fprintf data/sfst-1.4.7b/src/fst-infl2-daemon.C:198:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "> %s\n", word); data/sfst-1.4.7b/src/fst-infl2-daemon.C:238:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "no result for %s\n", word); data/sfst-1.4.7b/src/fst-infl2-daemon.C:280:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s.prob", Filenames[i]); data/sfst-1.4.7b/src/fst-infl2.C:218:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s.prob", Filenames[i]); data/sfst-1.4.7b/src/fst-train.C:197:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer, "%s.prob", Filenames[i]); data/sfst-1.4.7b/src/interface.C:346:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(message,"Error: Cannot open file \"%s\"!", filename); data/sfst-1.4.7b/src/interface.C:373:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(message,"Error: Cannot open file \"%s\"!",filename); data/sfst-1.4.7b/src/interface.C:380:7: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(message,"Error: incompatible character encoding in file \"%s\"!", data/sfst-1.4.7b/src/alphabet.C:115: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 symbol[100]; data/sfst-1.4.7b/src/alphabet.C:116:2: [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(symbol,">%ld<",(long)i); data/sfst-1.4.7b/src/alphabet.C:223: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 message[100]; data/sfst-1.4.7b/src/alphabet.C:237: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 message[100]; data/sfst-1.4.7b/src/alphabet.C:241:4: [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(message,"Error: defining a (very long) symbol with previously used character"); data/sfst-1.4.7b/src/alphabet.C:276:2: [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(buffer+(*pos),"\\%u", uc); data/sfst-1.4.7b/src/alphabet.C:293: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. static char buffer[1000]; data/sfst-1.4.7b/src/alphabet.C:329: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. static char buffer[1000]; data/sfst-1.4.7b/src/alphabet.C:534:7: [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 buffer[2]; data/sfst-1.4.7b/src/alphabet.C:568:14: [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 buffer[1000]; data/sfst-1.4.7b/src/alphabet.C:662:7: [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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/default-scanner.C:622:1: [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 *Name_Stack[MAX_INCLUDE_DEPTH]; data/sfst-1.4.7b/src/default-scanner.C:969:15: [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 = fopen( name, "rt" ); data/sfst-1.4.7b/src/default-scanner.C:1152:10: [2] (integer) atol: 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). { long l=atol(yytext+1); data/sfst-1.4.7b/src/fst-compact.C:53: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). if ((file = fopen(argv[n],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-compact.C:63: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). if ((outfile = fopen(argv[n],"wb")) == NULL) { data/sfst-1.4.7b/src/fst-compare.C:34: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). if ((file1 = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-compare.C:38: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). if ((file2 = fopen(argv[2],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-compiler.C:1252:3: [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 const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; data/sfst-1.4.7b/src/fst-compiler.C:1486:3: [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 yymsgbuf[128]; data/sfst-1.4.7b/src/fst-compiler.C:2585:15: [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 ((file = fopen(argv[1],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-compiler.C:2601: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). if ((file = fopen(argv[2],"wb")) == NULL) { data/sfst-1.4.7b/src/fst-generate.C:81: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). if ((MaxAnalyses = atoi(argv[i+1])), errno) { data/sfst-1.4.7b/src/fst-generate.C:120: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). else if ((file = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl.C:106: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). if ((file = fopen(Filenames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl.C:122: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-infl.C:131:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-infl.C:137: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-infl2-daemon.C:159:10: [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 buffer[10000]; data/sfst-1.4.7b/src/fst-infl2-daemon.C:196:3: [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 buffer[10000]; data/sfst-1.4.7b/src/fst-infl2-daemon.C:216:8: [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(buffer,"\t%f", prob[k]); data/sfst-1.4.7b/src/fst-infl2-daemon.C:260:16: [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 socketno=atoi(argv[1]); data/sfst-1.4.7b/src/fst-infl2-daemon.C:269: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). if ((file = fopen(Filenames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl2-daemon.C:279: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 buffer[1000]; data/sfst-1.4.7b/src/fst-infl2-daemon.C:281:15: [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 ((pfile = fopen(buffer,"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl2.C:207: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). if ((file = fopen(Filenames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl2.C:217: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 buffer[1000]; data/sfst-1.4.7b/src/fst-infl2.C:219:15: [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 ((pfile = fopen(buffer,"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl2.C:239: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-infl2.C:248:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-infl2.C:254: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-infl3.C:112: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). if ((file = fopen(Filenames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-infl3.C:128: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-infl3.C:137:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-infl3.C:143: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-lattice.C:99:15: [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 ((file = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-lattice.C:114: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-lattice.C:123:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-lattice.C:129: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-lowmem.C:53: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). if ((file = fopen(argv[n],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-lowmem.C:63: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). if ((outfile = fopen(argv[n],"wb")) == NULL) { data/sfst-1.4.7b/src/fst-match.C:88:15: [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 ((file = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-match.C:103: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-match.C:112:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-match.C:118: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-mor.C:21:10: [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 buffer[10000]; data/sfst-1.4.7b/src/fst-mor.C:105:15: [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 ((file = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-parse.C:106: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). if ((file = fopen(TFileNames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-parse.C:130: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-parse.C:138:22: [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(argv[3],"wt")) == NULL) { data/sfst-1.4.7b/src/fst-parse.C:144: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-parse2.C:106: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). if ((file = fopen(TFileNames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-parse2.C:130: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-parse2.C:136: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-print.C:39: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). else if ((file = fopen(argv[1],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-text2bin.C:37:15: [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 ((file = fopen(argv[1],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-text2bin.C:45: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). if ((file = fopen(argv[2],"wb")) == NULL) { data/sfst-1.4.7b/src/fst-train.C:140: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). if ((file = fopen(Filenames[i],"rb")) == NULL) { data/sfst-1.4.7b/src/fst-train.C:157: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). if ((file = fopen(argv[2],"rt")) == NULL) { data/sfst-1.4.7b/src/fst-train.C:171: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst-train.C:195:7: [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 buffer[1000]; data/sfst-1.4.7b/src/fst-train.C:198:22: [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(buffer,"wb")) == NULL) { data/sfst-1.4.7b/src/fst.C:286: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 buffer[10000]; data/sfst-1.4.7b/src/fst.C:562: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 buffer[BUFFER_SIZE]; data/sfst-1.4.7b/src/fst.C:913: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. static char message[1000]; data/sfst-1.4.7b/src/fst.C:914: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(message, "Error: in line %u of text transducer file", data/sfst-1.4.7b/src/fst.C:993: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 buffer[10000]; data/sfst-1.4.7b/src/interface.C:345:14: [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 message[1000]; data/sfst-1.4.7b/src/interface.C:370:18: [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 *file = fopen(filename,"rb"); data/sfst-1.4.7b/src/interface.C:372:14: [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 message[1000]; data/sfst-1.4.7b/src/interface.C:379:14: [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 message[1000]; data/sfst-1.4.7b/src/interface.C:1877: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). if ((file = fopen(filename,"wb")) == NULL) { data/sfst-1.4.7b/src/mem.h:30:7: [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 buffer[MEMBUFFER_SIZE]; data/sfst-1.4.7b/src/test.C:11: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). file = fopen(argv[1],"rb"); // open the input file data/sfst-1.4.7b/src/test.C:16: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 buffer[1000]; data/sfst-1.4.7b/src/utf8-scanner.C:648:1: [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 *Name_Stack[MAX_INCLUDE_DEPTH]; data/sfst-1.4.7b/src/utf8-scanner.C:995:15: [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 = fopen( name, "rt" ); data/sfst-1.4.7b/src/utf8-scanner.C:1178:10: [2] (integer) atol: 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). { long l=atol(yytext+1); data/sfst-1.4.7b/src/utf8.C:38:21: [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 unsigned char ch[5]; data/sfst-1.4.7b/src/alphabet.C:222:11: [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 (strlen(symbol) < 60) { data/sfst-1.4.7b/src/alphabet.C:238:6: [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 (strlen(symbol) < 70) data/sfst-1.4.7b/src/alphabet.C:266: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). int l=(int)strlen(s)-1; data/sfst-1.4.7b/src/alphabet.C:277:15: [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). *pos += (int)strlen(buffer+(*pos)); data/sfst-1.4.7b/src/alphabet.C:629:31: [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). fwrite(s, sizeof(char), strlen(s)+1, file); data/sfst-1.4.7b/src/alphabet.C:653:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void Alphabet::read( FILE *file ) data/sfst-1.4.7b/src/alphabet.C:656:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). utf8 = (fgetc(file) != 0); data/sfst-1.4.7b/src/alphabet.h:288:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read( FILE* ); data/sfst-1.4.7b/src/basic.C:32:39: [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). char* pStringCopy = (char*)malloc(strlen(pString) + 1); data/sfst-1.4.7b/src/basic.C:52:13: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int c=fgetc(file); data/sfst-1.4.7b/src/compact.C:191:21: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = (unsigned char)fgetc(file); data/sfst-1.4.7b/src/compact.C:333:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(file) != 'c') data/sfst-1.4.7b/src/compact.C:336:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). alphabet.read(file); data/sfst-1.4.7b/src/default-scanner.C:766:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/sfst-1.4.7b/src/default-scanner.C:963:13: [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). name[strlen(name)-1] = 0; data/sfst-1.4.7b/src/default-scanner.C:1119:20: [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). yylval.value[strlen(yylval.value)-2] = 0; data/sfst-1.4.7b/src/default-scanner.C:1128:20: [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). yylval.value[strlen(yylval.value)-1] = 0; data/sfst-1.4.7b/src/default-scanner.C:1936: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). return yy_scan_bytes(yystr,strlen(yystr) ); data/sfst-1.4.7b/src/fst-compiler.C:1137:21: [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). # define yystrlen strlen data/sfst-1.4.7b/src/fst-infl.C:139: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-infl2-daemon.C:173:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). last = (int)read( sockfd, buffer, 10000 ); data/sfst-1.4.7b/src/fst-infl2-daemon.C:199:28: [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). write( sockfd, buffer, strlen(buffer) ); data/sfst-1.4.7b/src/fst-infl2-daemon.C:214:24: [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). write( sockfd, s, strlen(s) ); data/sfst-1.4.7b/src/fst-infl2-daemon.C:217:31: [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). write( sockfd, buffer, strlen(buffer) ); data/sfst-1.4.7b/src/fst-infl2-daemon.C:230:24: [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). write( sockfd, s, strlen(s) ); data/sfst-1.4.7b/src/fst-infl2-daemon.C:239:30: [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). write( sockfd, buffer, strlen(buffer) ); data/sfst-1.4.7b/src/fst-infl2.C:260: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-infl3.C:149: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-lattice.C:133: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-match.C:124: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-mor.C:25: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). size_t l = strlen(buffer); data/sfst-1.4.7b/src/fst-parse.C:146:13: [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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-parse2.C:138:13: [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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst-train.C:176: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). int l=(int)strlen(buffer)-1; data/sfst-1.4.7b/src/fst.C:306:13: [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 l = strlen(buffer); data/sfst-1.4.7b/src/fst.C:321:19: [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). for( l=(int)strlen(buffer)-1; l>=0; l-- ) data/sfst-1.4.7b/src/fst.C:881:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(file) != 'a') data/sfst-1.4.7b/src/fst.C:897:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). alphabet.read(file); data/sfst-1.4.7b/src/fst.h:345:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). void read( FILE* ); // reads an transducer in binary format data/sfst-1.4.7b/src/lowmem.C:86:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (fgetc(file) != 'l') data/sfst-1.4.7b/src/lowmem.C:88:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). alphabet.read(file); data/sfst-1.4.7b/src/test.C:19:13: [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). int l=strlen(buffer)-1; // delete the newline character data/sfst-1.4.7b/src/utf8-scanner.C:792:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ data/sfst-1.4.7b/src/utf8-scanner.C:989:13: [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). name[strlen(name)-1] = 0; data/sfst-1.4.7b/src/utf8-scanner.C:1145:20: [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). yylval.value[strlen(yylval.value)-2] = 0; data/sfst-1.4.7b/src/utf8-scanner.C:1154:20: [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). yylval.value[strlen(yylval.value)-1] = 0; data/sfst-1.4.7b/src/utf8-scanner.C:1973: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). return yy_scan_bytes(yystr,strlen(yystr) ); ANALYSIS SUMMARY: Hits = 149 Lines analyzed = 18843 in approximately 0.51 seconds (37236 lines/second) Physical Source Lines of Code (SLOC) = 11838 Hits@level = [0] 160 [1] 47 [2] 89 [3] 0 [4] 13 [5] 0 Hits@level+ = [0+] 309 [1+] 149 [2+] 102 [3+] 13 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 26.1024 [1+] 12.5866 [2+] 8.61632 [3+] 1.09816 [4+] 1.09816 [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.