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/foma-0.9.18+r243/lexcread.c Examining data/foma-0.9.18+r243/sigma.c Examining data/foma-0.9.18+r243/coaccessible.c Examining data/foma-0.9.18+r243/extract.c Examining data/foma-0.9.18+r243/rewrite.c Examining data/foma-0.9.18+r243/determinize.c Examining data/foma-0.9.18+r243/lexc.h Examining data/foma-0.9.18+r243/dynarray.c Examining data/foma-0.9.18+r243/trie.c Examining data/foma-0.9.18+r243/constructions.c Examining data/foma-0.9.18+r243/fomalibconf.h Examining data/foma-0.9.18+r243/mem.c Examining data/foma-0.9.18+r243/cgflookup.c Examining data/foma-0.9.18+r243/minimize.c Examining data/foma-0.9.18+r243/stringhash.c Examining data/foma-0.9.18+r243/topsort.c Examining data/foma-0.9.18+r243/apply.c Examining data/foma-0.9.18+r243/iface.c Examining data/foma-0.9.18+r243/spelling.c Examining data/foma-0.9.18+r243/define.c Examining data/foma-0.9.18+r243/stack.c Examining data/foma-0.9.18+r243/utf8.c Examining data/foma-0.9.18+r243/flookup.c Examining data/foma-0.9.18+r243/structures.c Examining data/foma-0.9.18+r243/fomalib.h Examining data/foma-0.9.18+r243/int_stack.c Examining data/foma-0.9.18+r243/flags.c Examining data/foma-0.9.18+r243/foma.c Examining data/foma-0.9.18+r243/io.c Examining data/foma-0.9.18+r243/foma.h Examining data/foma-0.9.18+r243/reverse.c FINAL RESULTS: data/foma-0.9.18+r243/apply.c:978:3: [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(h->outstring+h->opos, astring); data/foma-0.9.18+r243/apply.c:981:3: [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(h->outstring+h->opos, astring); data/foma-0.9.18+r243/apply.c:983:3: [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(h->outstring+h->opos+alen,h->separator); data/foma-0.9.18+r243/apply.c:985:3: [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(h->outstring+h->opos+alen+strlen(h->separator),bstring); data/foma-0.9.18+r243/apply.c:1020: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(h->outstring+h->opos+1, astring); data/foma-0.9.18+r243/apply.c:1022: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(h->outstring+h->opos+alen+1,h->separator); data/foma-0.9.18+r243/apply.c:1024: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(h->outstring+h->opos+alen+1+strlen(h->separator), bstring); data/foma-0.9.18+r243/apply.c:1052:2: [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(h->outstring+h->opos+len, h->space_symbol); data/foma-0.9.18+r243/flags.c:146:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(string, flag_type_to_char(type)); data/foma-0.9.18+r243/flags.c:148:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(string, name); data/foma-0.9.18+r243/flags.c:151:9: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(string, value); data/foma-0.9.18+r243/iface.c:1693:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpstr,"/usr/bin/open -a Graphviz %s &",dotname); data/foma-0.9.18+r243/iface.c:1694:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(tmpstr) == -1) data/foma-0.9.18+r243/iface.c:1701:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpstr,"dot -Tpng %s > %s ",dotname,pngname); data/foma-0.9.18+r243/iface.c:1702:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(tmpstr) == -1) data/foma-0.9.18+r243/iface.c:1704:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpstr,"/usr/bin/xdg-open %s 2>/dev/null &",pngname); data/foma-0.9.18+r243/iface.c:1705:7: [4] (shell) system: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. if (system(tmpstr) == -1) data/foma-0.9.18+r243/io.c:104:3: [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(identifier, net->name); data/foma-0.9.18+r243/io.c:578:9: [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(d->net->name, d->name); data/foma-0.9.18+r243/io.c:706:5: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(buf, "%i %i %i %i %i %lld %i %i %i %i %i %i %s", &net->arity, &net->arccount, &net->statecount, &net->linecount, &net->finalcount, &net->pathcount, &net->is_deterministic, &net->is_pruned, &net->is_minimized, &net->is_epsilon_free, &net->is_loop_free, &extras, buf); data/foma-0.9.18+r243/io.c:707: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(net->name, buf); data/foma-0.9.18+r243/sigma.c:148:2: [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(sigma_splice->symbol, symbol); data/foma-0.9.18+r243/sigma.c:157:2: [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(sigma->symbol, symbol); data/foma-0.9.18+r243/spelling.c:73:25: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printptr += sprintf(medh->outstring+printptr,"%s", print_sym(sym, sigma)); data/foma-0.9.18+r243/spelling.c:77:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printptr += sprintf(medh->outstring+printptr,"%s",medh->align_symbol); data/foma-0.9.18+r243/spelling.c:100:25: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printptr += sprintf(medh->instring+printptr,"%s", print_sym(sym, sigma)); data/foma-0.9.18+r243/spelling.c:105:15: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. printptr += sprintf(medh->instring+printptr,"%s",medh->align_symbol); data/foma-0.9.18+r243/structures.c:28:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(s,"%i.%i.%i%s",MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,STATUS_VERSION); data/foma-0.9.18+r243/structures.c:217:3: [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(fsm->name, name); data/foma-0.9.18+r243/apply.c:274:5: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand((unsigned int) time(NULL)); data/foma-0.9.18+r243/cgflookup.c:103:19: [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 ((opt = getopt(argc, argv, "abhHiI:qs:uw:vx")) != -1) { data/foma-0.9.18+r243/flookup.c:123:19: [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 ((opt = getopt(argc, argv, "abhHiI:qs:SA:P:w:vx")) != -1) { data/foma-0.9.18+r243/foma.c:103:5: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand ((unsigned int)time(NULL)); data/foma-0.9.18+r243/foma.c:108:19: [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 ((opt = getopt(argc, argv, "e:f:hl:pqrsv")) != -1) { data/foma-0.9.18+r243/iface.c:1321:38: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. void iface_pairs_call(int limit, int random) { data/foma-0.9.18+r243/iface.c:1687:28: [3] (tmpfile) tempnam: Temporary file race condition (CWE-377). dotname = strncpy(tmpstr,tempnam(NULL,"foma"), 250); data/foma-0.9.18+r243/iface.c:1700:22: [3] (tmpfile) tempnam: Temporary file race condition (CWE-377). pngname = xxstrdup(tempnam(NULL, "foma")); data/foma-0.9.18+r243/apply.c:1008:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(h->outstring+h->opos, pstring, len); data/foma-0.9.18+r243/apply.c:1048:6: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(h->outstring+h->opos, pstring, len); data/foma-0.9.18+r243/cgflookup.c:65:8: [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[2048]; data/foma-0.9.18+r243/cgflookup.c:78:5: [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 testuc[1]; // Temp storage to test uc of first letter in string data/foma-0.9.18+r243/cgflookup.c:127:26: [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). index_mem_limit = 1024*atoi(optarg); data/foma-0.9.18+r243/cgflookup.c:131:31: [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). index_mem_limit = 1024*1024*atoi(optarg); data/foma-0.9.18+r243/cgflookup.c:135:18: [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). index_cutoff = atoi(optarg); data/foma-0.9.18+r243/constructions.c:74: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 *in, *out, *currin, *currout, tmpin[128], tmpout[128]; data/foma-0.9.18+r243/determinize.c:765:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(set_table+set_table_offset, set, setsize * sizeof(int)); data/foma-0.9.18+r243/dynarray.c:450: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(net->name, "%X",rand()); data/foma-0.9.18+r243/dynarray.c:459:9: [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(net->name, "%X",rand()); data/foma-0.9.18+r243/flookup.c:73:8: [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[2048]; data/foma-0.9.18+r243/flookup.c:147:26: [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). index_mem_limit = 1024*atoi(optarg); data/foma-0.9.18+r243/flookup.c:151:31: [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). index_mem_limit = 1024*1024*atoi(optarg); data/foma-0.9.18+r243/flookup.c:155:18: [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). index_cutoff = atoi(optarg); data/foma-0.9.18+r243/flookup.c:168:20: [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). port_number = atoi(optarg); data/foma-0.9.18+r243/foma.c:62: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 no_readline_line[512]; data/foma-0.9.18+r243/foma.c:99: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 *scriptfile, prompt[50]; data/foma-0.9.18+r243/foma.c:158:13: [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(prompt, "foma[%i]: ",stack_size()); data/foma-0.9.18+r243/foma.c:160:13: [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(prompt, "apply down> "); data/foma-0.9.18+r243/foma.c:162:13: [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(prompt, "apply up> "); data/foma-0.9.18+r243/foma.c:164:13: [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(prompt, "apply med> "); data/foma-0.9.18+r243/fomalib.h:108: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 name[40]; data/foma-0.9.18+r243/iface.c:383: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 *result, inword[LINE_LIMIT]; data/foma-0.9.18+r243/iface.c:392:14: [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). INFILE = fopen(infilename, "r"); data/foma-0.9.18+r243/iface.c:402: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). OUTFILE = fopen(outfilename, "w"); data/foma-0.9.18+r243/iface.c:568:12: [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(s+i)); data/foma-0.9.18+r243/iface.c:728: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). outfile = fopen(filename,"w"); data/foma-0.9.18+r243/iface.c:1049:61: [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. printf("%-17.17s: %s\n",global_vars[i].name, *((char **)(global_vars[i].ptr)) ); data/foma-0.9.18+r243/iface.c:1083:20: [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 **)(global_vars[i].ptr)) = xxstrdup(value); data/foma-0.9.18+r243/iface.c:1237: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 ((outfile = fopen(filename, "w")) == NULL) { data/foma-0.9.18+r243/iface.c:1370: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 ((outfile = fopen(filename, "w")) == NULL) { data/foma-0.9.18+r243/iface.c:1408: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). outfile = fopen(filename, "w"); data/foma-0.9.18+r243/iface.c:1466: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). if ((out = fopen(filename, "w")) == NULL) { data/foma-0.9.18+r243/iface.c:1544: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 size[20]; data/foma-0.9.18+r243/iface.c:1556:9: [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(size, "%i bytes. ", s); data/foma-0.9.18+r243/iface.c:1558:9: [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(size, "%.1f kB. ", sf/1024); data/foma-0.9.18+r243/iface.c:1560:9: [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(size, "%.1f MB. ", sf/1048576); data/foma-0.9.18+r243/iface.c:1562:9: [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(size, "%.1f GB. ", sf/1073741824); data/foma-0.9.18+r243/iface.c:1626: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). dotfile = fopen(filename,"w"); data/foma-0.9.18+r243/iface.c:1681: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 tmpstr[255]; data/foma-0.9.18+r243/iface.c:1688:3: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(dotname, ".dot"); data/foma-0.9.18+r243/io.c:86: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 *outstring, *instring, identifier[100]; data/foma-0.9.18+r243/io.c:91: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 ((out = fopen(filename, "w")) == NULL) { data/foma-0.9.18+r243/io.c:196: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 inword[1024], delimiters[] = "\t", *tokens[6]; data/foma-0.9.18+r243/io.c:199:14: [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). INFILE = fopen(filename, "r"); data/foma-0.9.18+r243/io.c:230:38: [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). fsm_construct_add_arc(h, atoi(tokens[0]), atoi(tokens[1]), tokens[2], tokens[3]); data/foma-0.9.18+r243/io.c:230:55: [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). fsm_construct_add_arc(h, atoi(tokens[0]), atoi(tokens[1]), tokens[2], tokens[3]); data/foma-0.9.18+r243/io.c:233:39: [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). fsm_construct_set_final(h,atoi(tokens[0])); data/foma-0.9.18+r243/io.c:245: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], temp [1024], in [128], out[128], *temp_ptr, *temp_ptr2; data/foma-0.9.18+r243/io.c:252: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). prolog_file = fopen(filename, "r"); data/foma-0.9.18+r243/io.c:281:36: [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). fsm_construct_set_final(outh, atoi(temp)); data/foma-0.9.18+r243/io.c:313:15: [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). source = atoi(temp); data/foma-0.9.18+r243/io.c:321:15: [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). target = atoi(temp); data/foma-0.9.18+r243/io.c:341:3: [2] (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). Risk is low because the source is a constant string. strcpy(in,"@_IDENTITY_SYMBOL_@"); data/foma-0.9.18+r243/io.c:344:3: [2] (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). Risk is low because the source is a constant string. strcpy(in,"@_UNKNOWN_SYMBOL_@"); data/foma-0.9.18+r243/io.c:347:3: [2] (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). Risk is low because the source is a constant string. strcpy(out,"@_UNKNOWN_SYMBOL_@"); data/foma-0.9.18+r243/io.c:350:3: [2] (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). Risk is low because the source is a constant string. strcpy(in,"@_EPSILON_SYMBOL_@"); data/foma-0.9.18+r243/io.c:353:3: [2] (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). Risk is low because the source is a constant string. strcpy(out,"@_EPSILON_SYMBOL_@"); data/foma-0.9.18+r243/io.c:610:31: [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). *(values+items) = atoi(buf+i); data/foma-0.9.18+r243/io.c:615:31: [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). *(values+items) = atoi(buf+i); data/foma-0.9.18+r243/io.c:677: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[READ_BUF_SIZE]; data/foma-0.9.18+r243/io.c:926: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. unsigned char bytes[4]; data/foma-0.9.18+r243/io.c:930:14: [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). infile = fopen(filename, "r"); data/foma-0.9.18+r243/io.c:946:14: [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). infile = fopen(filename, "r"); data/foma-0.9.18+r243/io.c:993:14: [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). infile = fopen(name, "r"); data/foma-0.9.18+r243/lexcread.c:605: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 tmpstring[5]; data/foma-0.9.18+r243/mem.c:52:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(r, s, n); data/foma-0.9.18+r243/spelling.c:113:15: [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. printptr += sprintf(medh->instring+printptr,"%.*s", utf8skip(word+i)+1, word+i); data/foma-0.9.18+r243/spelling.c:234: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 temputf[5] ; data/foma-0.9.18+r243/stack.c:51: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(fsm->name, "%X",rand()); data/foma-0.9.18+r243/structures.c:27: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 s[20]; data/foma-0.9.18+r243/structures.c:552: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 repstr[13]; data/foma-0.9.18+r243/structures.c:571:13: [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(repstr,"%012X",newsym++); data/foma-0.9.18+r243/structures.c:591: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 repstr[13]; data/foma-0.9.18+r243/structures.c:610:13: [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(repstr,"%012X",newsym++); data/foma-0.9.18+r243/structures.c:776:5: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(net_copy, net, sizeof(struct fsm)); data/foma-0.9.18+r243/structures.c:788:3: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(new_fsm_state, fsm_state, linecount*sizeof(struct fsm_state)); data/foma-0.9.18+r243/utf8.c:147:9: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(ptr, newstring, len); data/foma-0.9.18+r243/apply.c:93: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). (h->sigs+EPSILON)->length = strlen(h->epsilon_symbol); data/foma-0.9.18+r243/apply.c:960:40: [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). while (alen + blen + h->opos + 2 + strlen(h->separator) >= h->outstringtop) { data/foma-0.9.18+r243/apply.c:985:36: [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). strcpy(h->outstring+h->opos+alen+strlen(h->separator),bstring); data/foma-0.9.18+r243/apply.c:987: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). len = alen+blen+strlen(h->separator); data/foma-0.9.18+r243/apply.c:1016:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(astring, h->instring+h->ipos, 1); data/foma-0.9.18+r243/apply.c:1018:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(bstring, h->instring+h->ipos, 1); data/foma-0.9.18+r243/apply.c:1019:6: [1] (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). Risk is low because the source is a constant character. strcpy(h->outstring+h->opos, "<"); data/foma-0.9.18+r243/apply.c:1024:41: [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). strcpy(h->outstring+h->opos+alen+1+strlen(h->separator), bstring); data/foma-0.9.18+r243/apply.c:1026:6: [1] (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). Risk is low because the source is a constant character. strcpy(h->outstring+h->opos+alen+blen+1+strlen(h->separator),">"); data/foma-0.9.18+r243/apply.c:1026:46: [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). strcpy(h->outstring+h->opos+alen+blen+1+strlen(h->separator),">"); data/foma-0.9.18+r243/apply.c:1028: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). len = alen+blen+2+strlen(h->separator); data/foma-0.9.18+r243/apply.c:1035:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(h->outstring+h->opos, h->instring+h->ipos, idlen); data/foma-0.9.18+r243/apply.c:1036:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant character. strncpy(h->outstring+h->opos+idlen,"", 1); data/foma-0.9.18+r243/apply.c:1243:36: [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). (h->sigs+(sig->number))->length = strlen(sig->symbol); data/foma-0.9.18+r243/apply.c:1251: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). (h->sigs+EPSILON)->length = strlen(h->epsilon_symbol); data/foma-0.9.18+r243/apply.c:1294: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). inlen = strlen(symbol); data/foma-0.9.18+r243/constructions.c:101:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmpin, in, utf8skip(in)+1); data/foma-0.9.18+r243/constructions.c:113:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(tmpout, out, utf8skip(in)+1); data/foma-0.9.18+r243/constructions.c:158: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). length = strlen(symbol)-2; data/foma-0.9.18+r243/constructions.c:1034:21: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (unknown_1 && !equal) { data/foma-0.9.18+r243/constructions.c:1121:21: [1] (buffer) equal: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. if (unknown_2 && !equal) { data/foma-0.9.18+r243/dynarray.c:456:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(net->name, handle->name, 40); data/foma-0.9.18+r243/flags.c:143:36: [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). string = xxmalloc(sizeof(char)*strlen(name)+strlen(value)+6); data/foma-0.9.18+r243/flags.c:143:49: [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). string = xxmalloc(sizeof(char)*strlen(name)+strlen(value)+6); data/foma-0.9.18+r243/flags.c:145:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(string, "@"); data/foma-0.9.18+r243/flags.c:147:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(string, "."); data/foma-0.9.18+r243/flags.c:150:9: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(string, "."); data/foma-0.9.18+r243/flags.c:153:5: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(string, "@"); data/foma-0.9.18+r243/flags.c:279: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). if (strncmp(csym,name,strlen(name)) == 0 && (strlen(csym)>strlen(name)) && (strncmp(csym+strlen(name),".",1) == 0 || strncmp(csym+strlen(name),"@",1) == 0)) { data/foma-0.9.18+r243/flags.c:279: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). if (strncmp(csym,name,strlen(name)) == 0 && (strlen(csym)>strlen(name)) && (strncmp(csym+strlen(name),".",1) == 0 || strncmp(csym+strlen(name),"@",1) == 0)) { data/foma-0.9.18+r243/flags.c:279:75: [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 (strncmp(csym,name,strlen(name)) == 0 && (strlen(csym)>strlen(name)) && (strncmp(csym+strlen(name),".",1) == 0 || strncmp(csym+strlen(name),"@",1) == 0)) { data/foma-0.9.18+r243/flags.c:279:106: [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 (strncmp(csym,name,strlen(name)) == 0 && (strlen(csym)>strlen(name)) && (strncmp(csym+strlen(name),".",1) == 0 || strncmp(csym+strlen(name),"@",1) == 0)) { data/foma-0.9.18+r243/flags.c:279:147: [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 (strncmp(csym,name,strlen(name)) == 0 && (strlen(csym)>strlen(name)) && (strncmp(csym+strlen(name),".",1) == 0 || strncmp(csym+strlen(name),"@",1) == 0)) { data/foma-0.9.18+r243/flags.c:395: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). len = strlen(string); data/foma-0.9.18+r243/flags.c:416: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). len = strlen(string); data/foma-0.9.18+r243/flookup.c:99:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(serverstring+udpsize, line, UDP_MAX-udpsize); data/foma-0.9.18+r243/flookup.c:100: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). udpsize += strlen(line); data/foma-0.9.18+r243/flookup.c:101:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(serverstring+udpsize, separator, UDP_MAX-udpsize); data/foma-0.9.18+r243/flookup.c:102: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). udpsize += strlen(separator); data/foma-0.9.18+r243/flookup.c:105:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant string. strncat(serverstring+udpsize, "?+\n", UDP_MAX-udpsize); data/foma-0.9.18+r243/flookup.c:108:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(serverstring+udpsize, result, UDP_MAX-udpsize); data/foma-0.9.18+r243/flookup.c:109: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). udpsize += strlen(result); data/foma-0.9.18+r243/flookup.c:110:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. Risk is low because the source is a constant character. strncat(serverstring+udpsize, "\n", UDP_MAX-udpsize); data/foma-0.9.18+r243/flookup.c:257:46: [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). numbytes = sendto(listen_sd, serverstring, strlen(serverstring), 0, (struct sockaddr *)&clientaddr, addrlen); data/foma-0.9.18+r243/foma.c:218: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). len = strlen(text); data/foma-0.9.18+r243/iface.c:413: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). if (inword[strlen(inword)-1] == '\n') { data/foma-0.9.18+r243/iface.c:414: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). inword[strlen(inword)-1] = '\0'; data/foma-0.9.18+r243/iface.c:688:9: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(stack_find_top()->fsm->name, name, 40); data/foma-0.9.18+r243/iface.c:1291:6: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(string, result+i, 1); data/foma-0.9.18+r243/iface.c:1309: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). *upper = calloc(strlen(result), sizeof(char)); data/foma-0.9.18+r243/iface.c:1310: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). *lower = calloc(strlen(result), sizeof(char)); data/foma-0.9.18+r243/iface.c:1550: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). s += strlen(sigma->symbol)+1+sizeof(struct sigma); data/foma-0.9.18+r243/iface.c:1654: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). linelen += strlen((sigptr(net->sigma, (stateptr+j)->in))); data/foma-0.9.18+r243/iface.c:1657: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). linelen += strlen((sigptr(net->sigma, (stateptr+j)->in))) + strlen(sigptr(net->sigma, (stateptr+j)->out)) + 3; data/foma-0.9.18+r243/iface.c:1657:79: [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). linelen += strlen((sigptr(net->sigma, (stateptr+j)->in))) + strlen(sigptr(net->sigma, (stateptr+j)->out)) + 3; data/foma-0.9.18+r243/iface.c:1687:13: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). dotname = strncpy(tmpstr,tempnam(NULL,"foma"), 250); data/foma-0.9.18+r243/io.c:206: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). if (inword[strlen(inword)-1] == '\n') { data/foma-0.9.18+r243/io.c:207: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). inword[strlen(inword)-1] = '\0'; data/foma-0.9.18+r243/io.c:268:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:278:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:286:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:289:3: [1] (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). Risk is low because the source is a constant character. strcpy(temp, "0"); data/foma-0.9.18+r243/io.c:311:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:319:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temp, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:330:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(in, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:337:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(out, temp_ptr, (temp_ptr2 - temp_ptr)); data/foma-0.9.18+r243/io.c:356:3: [1] (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). Risk is low because the source is a constant character. strcpy(in,"0"); data/foma-0.9.18+r243/io.c:359:3: [1] (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). Risk is low because the source is a constant character. strcpy(out,"0"); data/foma-0.9.18+r243/io.c:362:3: [1] (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). Risk is low because the source is a constant character. strcpy(in,"?"); data/foma-0.9.18+r243/io.c:365:3: [1] (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). Risk is low because the source is a constant character. strcpy(out,"?"); data/foma-0.9.18+r243/io.c:448: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(t1) == 0) data/foma-0.9.18+r243/io.c:451: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). if (t2 == NULL || strlen(t2) == 0) { data/foma-0.9.18+r243/io.c:505: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(textp1) > 0) data/foma-0.9.18+r243/lexcread.c:607: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). len = strlen(string); data/foma-0.9.18+r243/lexcread.c:622:50: [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 (strncmp(string+i,mcs->symbol,strlen(mcs->symbol)) == 0) { data/foma-0.9.18+r243/lexcread.c:633: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). i += strlen(mcs->symbol); data/foma-0.9.18+r243/sigma.c:147:48: [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). sigma_splice->symbol = xxmalloc(sizeof(char)*(strlen(symbol)+1)); data/foma-0.9.18+r243/sigma.c:156:41: [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). sigma->symbol = xxmalloc(sizeof(char)*(strlen(symbol)+1)); data/foma-0.9.18+r243/spelling.c:81:25: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. printptr += sprintf(medh->outstring+printptr,"@"); data/foma-0.9.18+r243/spelling.c:110:15: [1] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source is a constant character. printptr += sprintf(medh->instring+printptr,"*"); data/foma-0.9.18+r243/spelling.c:251: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). medh->wordlen = strlen(word); data/foma-0.9.18+r243/spelling.c:261:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(temputf, word+i, thisskip); data/foma-0.9.18+r243/spelling.c:764: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). lsymbol = strlen(sigma->symbol) > lsymbol ? strlen(sigma->symbol) : lsymbol; data/foma-0.9.18+r243/spelling.c:764:53: [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). lsymbol = strlen(sigma->symbol) > lsymbol ? strlen(sigma->symbol) : lsymbol; data/foma-0.9.18+r243/spelling.c:794:36: [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("%.*s",(int)strlen(sigma_string(j, net->sigma))+1,"*"); data/foma-0.9.18+r243/spelling.c:796:36: [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("%.*d",(int)strlen(sigma_string(j, net->sigma))+1,*(cm+i*maxsigma+j)); data/foma-0.9.18+r243/trie.c:79: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). len = strlen(wcopy); data/foma-0.9.18+r243/trie.c:81:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(wcopy, word, utf8skip(word)+1); data/foma-0.9.18+r243/utf8.c:29: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). len = strlen(s)-1; data/foma-0.9.18+r243/utf8.c:44: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). for (i = strlen(string) - 1; i >=0; i--) { data/foma-0.9.18+r243/utf8.c:57: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). for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2) { data/foma-0.9.18+r243/utf8.c:68:23: [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 (i=0,j=0; i < strlen(string); i++) { data/foma-0.9.18+r243/utf8.c:74: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). newstring = xxcalloc((strlen(string)+j),sizeof(char)); data/foma-0.9.18+r243/utf8.c:75:25: [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 (i=0,j=0; i<strlen(string); i++, j++) { data/foma-0.9.18+r243/utf8.c:92: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). len = strlen(s); data/foma-0.9.18+r243/utf8.c:104: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). len = strlen(s); data/foma-0.9.18+r243/utf8.c:122: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). len = strlen(s); data/foma-0.9.18+r243/utf8.c:144: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). len = strlen(oldstring); data/foma-0.9.18+r243/utf8.c:163: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). len = strlen(str); ANALYSIS SUMMARY: Hits = 215 Lines analyzed = 17604 in approximately 0.55 seconds (32207 lines/second) Physical Source Lines of Code (SLOC) = 13797 Hits@level = [0] 257 [1] 99 [2] 79 [3] 8 [4] 29 [5] 0 Hits@level+ = [0+] 472 [1+] 215 [2+] 116 [3+] 37 [4+] 29 [5+] 0 Hits/KSLOC@level+ = [0+] 34.2103 [1+] 15.5831 [2+] 8.40762 [3+] 2.68174 [4+] 2.10191 [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.