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/irstlm-6.00.05/src/cmd.h Examining data/irstlm-6.00.05/src/compile-lm.cpp Examining data/irstlm-6.00.05/src/cplsa.cpp Examining data/irstlm-6.00.05/src/cplsa.h Examining data/irstlm-6.00.05/src/crc.cpp Examining data/irstlm-6.00.05/src/crc.h Examining data/irstlm-6.00.05/src/cswa.cpp Examining data/irstlm-6.00.05/src/cswam.cpp Examining data/irstlm-6.00.05/src/cswam.h Examining data/irstlm-6.00.05/src/dict.cpp Examining data/irstlm-6.00.05/src/dictionary.cpp Examining data/irstlm-6.00.05/src/dictionary.h Examining data/irstlm-6.00.05/src/doc.cpp Examining data/irstlm-6.00.05/src/doc.h Examining data/irstlm-6.00.05/src/dtsel.cpp Examining data/irstlm-6.00.05/src/gzfilebuf.h Examining data/irstlm-6.00.05/src/htable.cpp Examining data/irstlm-6.00.05/src/htable.h Examining data/irstlm-6.00.05/src/index.h Examining data/irstlm-6.00.05/src/interplm.cpp Examining data/irstlm-6.00.05/src/interplm.h Examining data/irstlm-6.00.05/src/interpolate-lm.cpp Examining data/irstlm-6.00.05/src/linearlm.cpp Examining data/irstlm-6.00.05/src/linearlm.h Examining data/irstlm-6.00.05/src/lmContainer.cpp Examining data/irstlm-6.00.05/src/lmContainer.h Examining data/irstlm-6.00.05/src/lmInterpolation.cpp Examining data/irstlm-6.00.05/src/lmInterpolation.h Examining data/irstlm-6.00.05/src/lmclass.cpp Examining data/irstlm-6.00.05/src/lmclass.h Examining data/irstlm-6.00.05/src/lmmacro.cpp Examining data/irstlm-6.00.05/src/lmmacro.h Examining data/irstlm-6.00.05/src/lmtable.h Examining data/irstlm-6.00.05/src/mdiadapt.h Examining data/irstlm-6.00.05/src/mempool.cpp Examining data/irstlm-6.00.05/src/mempool.h Examining data/irstlm-6.00.05/src/mfstream.cpp Examining data/irstlm-6.00.05/src/mfstream.h Examining data/irstlm-6.00.05/src/mixture.cpp Examining data/irstlm-6.00.05/src/mixture.h Examining data/irstlm-6.00.05/src/n_gram.cpp Examining data/irstlm-6.00.05/src/n_gram.h Examining data/irstlm-6.00.05/src/ngramcache.cpp Examining data/irstlm-6.00.05/src/ngramcache.h Examining data/irstlm-6.00.05/src/ngramtable.cpp Examining data/irstlm-6.00.05/src/ngramtable.h Examining data/irstlm-6.00.05/src/ngt.cpp Examining data/irstlm-6.00.05/src/normcache.cpp Examining data/irstlm-6.00.05/src/normcache.h Examining data/irstlm-6.00.05/src/plsa.cpp Examining data/irstlm-6.00.05/src/prune-lm.cpp Examining data/irstlm-6.00.05/src/quantize-lm.cpp Examining data/irstlm-6.00.05/src/score-lm.cpp Examining data/irstlm-6.00.05/src/shiftlm.cpp Examining data/irstlm-6.00.05/src/shiftlm.h Examining data/irstlm-6.00.05/src/stream-tlm.cpp Examining data/irstlm-6.00.05/src/thpool.c Examining data/irstlm-6.00.05/src/thpool.h Examining data/irstlm-6.00.05/src/timer.cpp Examining data/irstlm-6.00.05/src/timer.h Examining data/irstlm-6.00.05/src/tlm.cpp Examining data/irstlm-6.00.05/src/util.cpp Examining data/irstlm-6.00.05/src/util.h Examining data/irstlm-6.00.05/src/verify-caching.cpp Examining data/irstlm-6.00.05/src/mdiadapt.cpp Examining data/irstlm-6.00.05/src/lmtable.cpp Examining data/irstlm-6.00.05/src/cmd.c FINAL RESULTS: data/irstlm-6.00.05/src/cmd.c:208: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(Line, environ[i]+4); data/irstlm-6.00.05/src/cmd.c:240:5: [4] (shell) popen: 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. ? popen(CmdFile+2, "r") data/irstlm-6.00.05/src/cmd.c:276: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(Line, *argv+dash_number); data/irstlm-6.00.05/src/cmd.c:278:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Line, "%s/%s", ProgName, *argv+dash_number); data/irstlm-6.00.05/src/cmd.c:282:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Line, "%s/%s", ProgName, *argv+dash_number); data/irstlm-6.00.05/src/cmd.c:408:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(a[0][n], "%s%s=%s", pfx, cmd->Name, cmd->ArgStr); data/irstlm-6.00.05/src/cplsa.cpp:138:13: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(Hfname,"/%s/Hfname%d",tmpdir,(int)getpid()); data/irstlm-6.00.05/src/cplsa.cpp:324:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(outfname,"%s.%03d",fname,(int)d+1); data/irstlm-6.00.05/src/cplsa.cpp:491:34: [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 (trset->numdoc()> 10) system("date"); data/irstlm-6.00.05/src/cswam.cpp:1013:38: [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 (srcdata->numdoc()>10000) system("date"); data/irstlm-6.00.05/src/dictionary.h:149:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buffer,"%s",w); data/irstlm-6.00.05/src/dtsel.cpp:241:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(command,"cut -d \" \" -f 2- %s",outdom); data/irstlm-6.00.05/src/dtsel.cpp:243:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(command,"%s",outdom); data/irstlm-6.00.05/src/lmmacro.cpp:400:4: [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(curr_token, getDict()->decode(*in.wordp(i))); data/irstlm-6.00.05/src/lmmacro.cpp:632: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(curr_token, ((lmmacro *)this)->getDict()->decode(*(in->wordp(i)))); data/irstlm-6.00.05/src/lmmacro.cpp:693: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(curr_token, getDict()->decode(*(in->wordp(i)))); data/irstlm-6.00.05/src/lmmacro.cpp:835:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s", curr_macrotag); // non lessicalizzo il macrotag se sono ancora all''interno del chunk data/irstlm-6.00.05/src/lmmacro.cpp:837:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s_class%d", curr_macrotag, lexicaltoken2classMap[lmtable::getDict()->encode(curr_lemma)]); data/irstlm-6.00.05/src/lmmacro.cpp:839:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s_%s", curr_macrotag, lemmas[microsize]); data/irstlm-6.00.05/src/lmmacro.cpp:857:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s", curr_macrotag); // non lessicalizzo il macrotag se sono ancora all''interno del chunk data/irstlm-6.00.05/src/lmmacro.cpp:859:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s_class%d", curr_macrotag, lexicaltoken2classMap[lmtable::getDict()->encode(curr_lemma)]); data/irstlm-6.00.05/src/lmmacro.cpp:861:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tag_lemma, "%s_%s", curr_macrotag, curr_lemma); data/irstlm-6.00.05/src/lmtable.cpp:608: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(nameNgrams,outfilename); data/irstlm-6.00.05/src/lmtable.cpp:695: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(nameHeader,outfilename); data/irstlm-6.00.05/src/lmtable.cpp:722:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmd,"cat %s >> %s", nameNgrams, nameHeader); data/irstlm-6.00.05/src/lmtable.cpp:724:3: [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. system(cmd); data/irstlm-6.00.05/src/lmtable.cpp:726:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmd,"mv %s %s", nameHeader, outfilename); data/irstlm-6.00.05/src/lmtable.cpp:728:3: [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. system(cmd); data/irstlm-6.00.05/src/lmtable.cpp:876:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",outfilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1694:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",outfilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1737:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",outfilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1776:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(fromnameNgrams,"%s-%dgrams",fromfilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1777:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tonameNgrams,"%s-%dgrams",tofilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1784:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmd,"cat %s >> %s", fromnameNgrams, tonameNgrams); data/irstlm-6.00.05/src/lmtable.cpp:1785:3: [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. system(cmd); data/irstlm-6.00.05/src/lmtable.cpp:1800:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",filename,level); data/irstlm-6.00.05/src/lmtable.cpp:1821:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",outfilename,level); data/irstlm-6.00.05/src/lmtable.cpp:1848:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",filename,level); data/irstlm-6.00.05/src/lmtable.cpp:1855:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(cmd,"cat %s >> %s", nameNgrams, filename); data/irstlm-6.00.05/src/lmtable.cpp:1856:3: [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. system(cmd); data/irstlm-6.00.05/src/lmtable.cpp:1878:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(nameNgrams,"%s-%dgrams",outfilename,level); data/irstlm-6.00.05/src/mdiadapt.cpp:758:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:915:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1031:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1070:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1175:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1209:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tfilename[i],"%s-%dgrams",filename,i); data/irstlm-6.00.05/src/mdiadapt.cpp:1250:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpfilename,"%s_tmp_%d",filename,w); data/irstlm-6.00.05/src/mdiadapt.cpp:1461:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1471:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1519:4: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1706:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1726:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tfilename[i],"%s.%d",filename,i); data/irstlm-6.00.05/src/mdiadapt.cpp:1926:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:1936:3: [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. system("date"); data/irstlm-6.00.05/src/mdiadapt.cpp:2144:3: [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. system("date"); data/irstlm-6.00.05/src/mempool.cpp:278: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(&list->block[idx],s); data/irstlm-6.00.05/src/mfstream.cpp:49: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(_cmdname,name); data/irstlm-6.00.05/src/mfstream.cpp:50:11: [4] (shell) popen: 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. _FILE=popen(name,cmode); data/irstlm-6.00.05/src/mfstream.cpp:158: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(a,_cmdname); data/irstlm-6.00.05/src/mfstream.h:41:9: [4] (shell) popen: 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. FILE *popen(const char *command, const char *type); data/irstlm-6.00.05/src/mixture.cpp:115:17: [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(par[j],word); data/irstlm-6.00.05/src/ngramtable.cpp:229:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(info2,"%s %d %f",info,resolution,decay); data/irstlm-6.00.05/src/ngramtable.cpp:230: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(info, info2); data/irstlm-6.00.05/src/ngramtable.cpp:375:17: [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(ngstring,ng.dict->decode(*ng.wordp(ng.size))); data/irstlm-6.00.05/src/ngramtable.cpp:378:21: [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(ngstring,ng.dict->decode(*ng.wordp(i))); data/irstlm-6.00.05/src/ngramtable.cpp:773:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(info,"hm%s\n",hmask); data/irstlm-6.00.05/src/ngramtable.h:181:24: [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). if (str!=NULL) strcpy(info,str); data/irstlm-6.00.05/src/ngt.cpp:354:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(info,"hm%s",hmask); data/irstlm-6.00.05/src/stream-tlm.cpp:295:9: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmpngtfile,"%s.ngt%d",filename,cmdcounter); data/irstlm-6.00.05/src/stream-tlm.cpp:354:13: [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(lastwords[i],lm->dict->decode(*ng.wordp(i))); data/irstlm-6.00.05/src/stream-tlm.cpp:356:13: [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(lastwords[i],lm->dict->BoS()); data/irstlm-6.00.05/src/stream-tlm.cpp:409: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(isym,lm->dict->EoS()); data/irstlm-6.00.05/src/tlm.cpp:529:6: [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. system("echo > .tlmlock"); data/irstlm-6.00.05/src/tlm.cpp:543:6: [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. system("rm .tlmlock"); data/irstlm-6.00.05/src/util.cpp:71: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(buffer, tmpfolder.c_str()); data/irstlm-6.00.05/src/util.cpp:111:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. void *MMap(int fd, int access, off_t offset, size_t len, off_t *gap) data/irstlm-6.00.05/src/util.cpp:149:28: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. p = mmap((void*)0, len+g, access, data/irstlm-6.00.05/src/util.h:66:24: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. void *MMap(int fd, int access, off_t offset, size_t len, off_t *gap); data/irstlm-6.00.05/src/compile-lm.cpp:235:7: [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(1234); data/irstlm-6.00.05/src/cplsa.cpp:66:5: [3] (random) srandom: 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. srandom(100); //consistent generation of random noise data/irstlm-6.00.05/src/cswam.cpp:93:5: [3] (random) srandom: 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. srandom(100); //ensure repicable generation of random numbers data/irstlm-6.00.05/src/cswam.cpp:156:5: [3] (random) srandom: 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. srandom(crc16_ccitt(word,strlen(word))+it); data/irstlm-6.00.05/src/mixture.cpp:345:3: [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(1333); data/irstlm-6.00.05/src/plsa.cpp:85:20: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *tmpdir = getenv("TMP"); data/irstlm-6.00.05/src/util.cpp:45:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *tmpPath = getenv("TMP"); data/irstlm-6.00.05/src/util.cpp:51:18: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *tmpPath = getenv("TMP"); data/irstlm-6.00.05/src/util.h:19:26: [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. #define MY_RAND (((float)random()/RAND_MAX)* 2.0 - 1.0) data/irstlm-6.00.05/src/cmd.c:242:5: [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). ? fopen(CmdFile, "r") data/irstlm-6.00.05/src/cmd.c:546: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 ts[128]; data/irstlm-6.00.05/src/cmd.c:572:17: [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. if(TypeFlag) sprintf(ts, " [int]"); data/irstlm-6.00.05/src/cmd.c:574:23: [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. if(TypeFlag&&!*ts) sprintf(ts, " [int %d ... %d]", data/irstlm-6.00.05/src/cmd.c:578:23: [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. if(TypeFlag&&!*ts) sprintf(ts, " [int >= %d]", data/irstlm-6.00.05/src/cmd.c:581:23: [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. if(TypeFlag&&!*ts) sprintf(ts, " [int <= %d]", data/irstlm-6.00.05/src/cmd.c:1234: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(a[n], p, l); data/irstlm-6.00.05/src/cmd.c:1270: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). *i++ = atoi(p); data/irstlm-6.00.05/src/cplsa.cpp:139:21: [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 ((fd=fopen(Hfname,"w+"))==0){ data/irstlm-6.00.05/src/cplsa.cpp:285: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 header[100]; data/irstlm-6.00.05/src/cplsa.cpp:306:19: [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. inp.read((char *)W[i],sizeof(float) * topics); data/irstlm-6.00.05/src/cplsa.h:36: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 Hfname[100]; //temporary and unique filename for H data/irstlm-6.00.05/src/cswa.cpp:183:20: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE* f;if ((f=fopen(modelfile,"r"))!=NULL){fclose(f);testmodel=true;} data/irstlm-6.00.05/src/cswam.cpp:181: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 word[100]; float dummy; int f; data/irstlm-6.00.05/src/cswam.cpp:255:13: [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(TM[e].G[n].M,W2V[f],sizeof(float) * D); data/irstlm-6.00.05/src/cswam.cpp:315:20: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE* f;if ((f=fopen(modelfile,"r"))!=NULL){fclose(f);model_available=true;} data/irstlm-6.00.05/src/cswam.cpp:384: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 header[100]; data/irstlm-6.00.05/src/cswam.cpp:430:19: [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. inp.read((char *)TM[e].W,sizeof(float) * TM[e].n); data/irstlm-6.00.05/src/cswam.cpp:435:23: [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. inp.read((char *)TM[e].G[n].M,sizeof(float) * D); data/irstlm-6.00.05/src/cswam.cpp:436:23: [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. inp.read((char *)TM[e].G[n].S,sizeof(float) * D); data/irstlm-6.00.05/src/cswam.cpp:770:13: [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((void *)nG,(const void *)TM[e].G, (n+1) * sizeof(Gaussian)); data/irstlm-6.00.05/src/cswam.cpp:771:13: [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((void *)nW,(const void *)TM[e].W, (n+1) * sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:773:17: [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((void *)&nG[n+2],(const void*)&TM[e].G[n+1],(TM[e].n-n-1) * sizeof(Gaussian)); data/irstlm-6.00.05/src/cswam.cpp:774:17: [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((void *)&nW[n+2],(const void*)&TM[e].W[n+1],(TM[e].n-n-1) * sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:855:17: [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((void *)nG,(const void *)TM[e].G, n * sizeof(Gaussian)); data/irstlm-6.00.05/src/cswam.cpp:856:17: [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((void *)nW,(const void *)TM[e].W, n * sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:859:17: [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((void *)&nG[n],(const void*)&TM[e].G[n+1],(TM[e].n-n-1) * sizeof(Gaussian)); data/irstlm-6.00.05/src/cswam.cpp:860:17: [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((void *)&nW[n],(const void*)&TM[e].W[n+1],(TM[e].n-n-1) * sizeof(float)); data/irstlm-6.00.05/src/dictionary.cpp:67: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[100]; data/irstlm-6.00.05/src/dictionary.cpp:110: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[MAX_WORD]; data/irstlm-6.00.05/src/dictionary.cpp:220: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. char buffer[MAX_WORD]; data/irstlm-6.00.05/src/dictionary.cpp:267: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 header[100]; data/irstlm-6.00.05/src/dictionary.cpp:269: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[MAX_WORD]; data/irstlm-6.00.05/src/dictionary.cpp:327: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[MAX_WORD]; data/irstlm-6.00.05/src/dictionary.cpp:460:2: [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(tb2,tb,sizeof(dict_entry) * lim ); data/irstlm-6.00.05/src/dictionary.h:148: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[MAX_WORD]; data/irstlm-6.00.05/src/doc.cpp:34: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 header[100]; data/irstlm-6.00.05/src/doc.cpp:69:17: [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(V[n],tmp,m * sizeof(int)); data/irstlm-6.00.05/src/dtsel.cpp:238: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 command[1000]=""; data/irstlm-6.00.05/src/gzfilebuf.h:87: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 _buff[_buffsize]; data/irstlm-6.00.05/src/interplm.cpp:142: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). prune_freq_threshold[i]=atoi(tk); data/irstlm-6.00.05/src/interplm.cpp:359: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 header[100]; data/irstlm-6.00.05/src/interpolate-lm.cpp:186: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 line[BUFSIZ]; data/irstlm-6.00.05/src/interpolate-lm.cpp:196:5: [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). N=atoi(words[1]); data/irstlm-6.00.05/src/lmInterpolation.cpp:60: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmInterpolation.cpp:69:17: [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). m_number_lm = atoi(words[1]); data/irstlm-6.00.05/src/lmclass.cpp:75: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmclass.cpp:84: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). maxlev = atoi(words[1]); data/irstlm-6.00.05/src/lmclass.cpp:139: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmmacro.cpp:72: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmmacro.cpp:80: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). maxlev = atoi(words[1]); data/irstlm-6.00.05/src/lmmacro.cpp:81:19: [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). selectedField = atoi(words[2]); data/irstlm-6.00.05/src/lmmacro.cpp:91:29: [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). selectedFieldForLexicon = atoi(words[3]); data/irstlm-6.00.05/src/lmmacro.cpp:92: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). collapseFlag = atoi(words[4]); data/irstlm-6.00.05/src/lmmacro.cpp:212: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmmacro.cpp:399:4: [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 curr_token[BUFSIZ]; data/irstlm-6.00.05/src/lmmacro.cpp:631: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 curr_token[BUFSIZ]; data/irstlm-6.00.05/src/lmmacro.cpp:688:4: [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 *lemmas[BUFSIZ]; data/irstlm-6.00.05/src/lmmacro.cpp:692: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 curr_token[BUFSIZ]; data/irstlm-6.00.05/src/lmmacro.cpp:822: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 tag_lemma[BUFSIZ]; data/irstlm-6.00.05/src/lmmacro.cpp:890: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmmacro.cpp:905: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). int classIdx = atoi(words[1]); data/irstlm-6.00.05/src/lmmacro.cpp:940: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 curr_NoLexMacro[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:464: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 header[MAX_LINE]; data/irstlm-6.00.05/src/lmtable.cpp:503: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmtable.cpp:532: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:533: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 nameHeader[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:543: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmtable.cpp:559:21: [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 (!(maxlevel_h=atoi(line))) { data/irstlm-6.00.05/src/lmtable.cpp:566:25: [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 (!(NumCenters[n]=atoi(line))) { data/irstlm-6.00.05/src/lmtable.cpp:609:6: [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(nameNgrams, "-ngrams"); data/irstlm-6.00.05/src/lmtable.cpp:611:11: [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). fd = fopen(nameNgrams, "w+"); data/irstlm-6.00.05/src/lmtable.cpp:635:18: [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. table[l]=(char *)(table[l-1] + (table_pos_t) maxsize[l-1]*nodesize(tbltype[l-1]) + data/irstlm-6.00.05/src/lmtable.cpp:638:18: [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. table[l]=(char *)(table[l-1] + (table_pos_t) maxsize[l-1]*nodesize(tbltype[l-1]) + data/irstlm-6.00.05/src/lmtable.cpp:650:7: [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(table[Order] - 2 * NumCenters[Order] * sizeof(float), data/irstlm-6.00.05/src/lmtable.cpp:653:7: [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(table[Order] - NumCenters[Order] * sizeof(float), data/irstlm-6.00.05/src/lmtable.cpp:657:7: [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(table[Order] - NumCenters[Order] * sizeof(float), data/irstlm-6.00.05/src/lmtable.cpp:696: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(nameHeader, "-header"); data/irstlm-6.00.05/src/lmtable.cpp:721: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 cmd[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:741: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 line[MAX_LINE]; data/irstlm-6.00.05/src/lmtable.cpp:875: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:880:8: [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). fd = fopen(nameNgrams, "w+"); data/irstlm-6.00.05/src/lmtable.cpp:1287: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 w[LMTCODESIZE]; data/irstlm-6.00.05/src/lmtable.cpp:1390: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(slmt->Pcenters[i],Pcenters[i],NumCenters[i] * sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1394: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(slmt->Bcenters[i],Bcenters[i],NumCenters[i] * sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1439:7: [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(newentry,entry,ndsz); data/irstlm-6.00.05/src/lmtable.cpp:1476: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(newentry,entry,ndsz); data/irstlm-6.00.05/src/lmtable.cpp:1525: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 buff[100]; data/irstlm-6.00.05/src/lmtable.cpp:1527: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(buff,"ngram %2d=%10d\n",l,(isPruned?cnt[l]:cursize[l])); data/irstlm-6.00.05/src/lmtable.cpp:1578:4: [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 buff[100]; data/irstlm-6.00.05/src/lmtable.cpp:1580: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(buff," %10d",cursize[i]); data/irstlm-6.00.05/src/lmtable.cpp:1592:17: [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. out.write((char *)Bcenters[i],NumCenters[i] * sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1693: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1736: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1774: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 fromnameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1775: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 tonameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1783: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 cmd[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1799: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1820: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1847: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1854: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 cmd[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1877: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 nameNgrams[BUFSIZ]; data/irstlm-6.00.05/src/lmtable.cpp:1885:8: [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). fd = fopen(nameNgrams, "r+"); data/irstlm-6.00.05/src/lmtable.cpp:1902: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(ptr,table[level],filesize); data/irstlm-6.00.05/src/lmtable.cpp:1943: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 header2[MAX_LINE]; data/irstlm-6.00.05/src/lmtable.cpp:1961: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. inp.read((char *)Bcenters[l],NumCenters[l]*sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1989:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). if ((diskid=open(filename, O_RDONLY))<0) { data/irstlm-6.00.05/src/lmtable.cpp:1995:4: [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 miniheader[4]; data/irstlm-6.00.05/src/lmtable.cpp:2038:18: [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. table[level]=(char *)MMap(diskid,PROT_READ, data/irstlm-6.00.05/src/lmtable.cpp:2681:15: [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. table[l]=(char *)MMap(diskid,PROT_READ, data/irstlm-6.00.05/src/lmtable.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 info[100]; //information put in the header data/irstlm-6.00.05/src/lmtable.h:364:4: [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+offs, &value, sizeof(T)); data/irstlm-6.00.05/src/lmtable.h:370:4: [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((void*)value, ptr+offs, sizeof(T)); data/irstlm-6.00.05/src/mdiadapt.cpp:770:11: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE* f=fopen(filename,"w"); data/irstlm-6.00.05/src/mdiadapt.cpp:1196: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 buff[100]; data/irstlm-6.00.05/src/mdiadapt.cpp:1200: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 tmpfilename[BUFSIZ]; data/irstlm-6.00.05/src/mdiadapt.cpp:1204: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 tfilename[LMTMAXLEV+1][1000]; data/irstlm-6.00.05/src/mdiadapt.cpp:1219: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(buff," %10d",0); data/irstlm-6.00.05/src/mdiadapt.cpp:1449: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(buff," %10d",num[i]); data/irstlm-6.00.05/src/mdiadapt.cpp:1487: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 buff[100]; data/irstlm-6.00.05/src/mdiadapt.cpp:1496: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(buff," %10d",0); data/irstlm-6.00.05/src/mdiadapt.cpp:1687: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(buff," %10d",lmt->getCurrentSize(i)); data/irstlm-6.00.05/src/mdiadapt.cpp:1721: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 tfilename[LMTMAXLEV+1][1000]; data/irstlm-6.00.05/src/mdiadapt.cpp:1907: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 buff[100]; data/irstlm-6.00.05/src/mdiadapt.cpp:1909: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(buff,"ngram %2d=%10d\n",i,num[i]); data/irstlm-6.00.05/src/mdiadapt.cpp:1952: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 buff[100]; data/irstlm-6.00.05/src/mdiadapt.cpp:1960: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(buff,"ngram %2d=%10d\n",i,num[i]); data/irstlm-6.00.05/src/mdiadapt.cpp:2137: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(buff,"ngram %2d=%10u\n",i,num[i]); data/irstlm-6.00.05/src/mempool.cpp:444:4: [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(newptr,oldptr,oldsize); data/irstlm-6.00.05/src/mfstream.cpp:33:16: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void mfstream::open(const char *name,openmode mode) data/irstlm-6.00.05/src/mfstream.cpp:36: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 cmode[10]; data/irstlm-6.00.05/src/mfstream.cpp:55:14: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fstream::open(name,mode); data/irstlm-6.00.05/src/mfstream.cpp:161:3: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). open(a,ios::in); data/irstlm-6.00.05/src/mfstream.cpp:177:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). _good=(fb->open(filePath.c_str(), std::ios::in)!=NULL); data/irstlm-6.00.05/src/mfstream.h:131: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[bufferSize]; // data buffer data/irstlm-6.00.05/src/mfstream.h:157: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 _cmdname[500]; data/irstlm-6.00.05/src/mfstream.h:172:5: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). open(name,mode); data/irstlm-6.00.05/src/mfstream.h:181:8: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open(const char *name,openmode mode); data/irstlm-6.00.05/src/mixture.cpp:87: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. char line[MAX_LINE]; data/irstlm-6.00.05/src/mixture.cpp:322: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 header[100]; data/irstlm-6.00.05/src/mixture.cpp:382: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 alive[pmax],used[pmax]; data/irstlm-6.00.05/src/n_gram.cpp:63: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(word,ng.word,sizeof(int)*MAX_NGRAM); data/irstlm-6.00.05/src/n_gram.cpp:64: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(midx,ng.word,sizeof(int)*MAX_NGRAM); data/irstlm-6.00.05/src/n_gram.cpp:87: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(word,ng.word,sizeof(int)*MAX_NGRAM); data/irstlm-6.00.05/src/n_gram.cpp:88: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(midx,ng.midx,sizeof(int)*MAX_NGRAM); data/irstlm-6.00.05/src/n_gram.cpp:123: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 w[MAX_WORD]; data/irstlm-6.00.05/src/n_gram.cpp:142: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(ng.word,ng.word+1,(MAX_NGRAM-1)*sizeof(int)); data/irstlm-6.00.05/src/n_gram.cpp:201: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((void *)&word[MAX_NGRAM - codes_len],(void*)&codes[0],codes_len*sizeof(int)); data/irstlm-6.00.05/src/n_gram.cpp:238: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 w[MAX_WORD]; data/irstlm-6.00.05/src/ngramcache.cpp:87: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(&info,found+ngsize*sizeof(int),infosize); data/irstlm-6.00.05/src/ngramcache.cpp:100: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(&info,found+ngsize*sizeof(int),infosize); data/irstlm-6.00.05/src/ngramcache.cpp:114: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(&info,found+ngsize*sizeof(int),infosize); data/irstlm-6.00.05/src/ngramcache.cpp:123: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(entry,(char*) ngp,sizeof(int) * ngsize); data/irstlm-6.00.05/src/ngramcache.cpp:124: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(entry + ngsize * sizeof(int),&info,infosize); data/irstlm-6.00.05/src/ngramcache.cpp:134: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(entry,(char*) ngp,sizeof(int) * ngsize); data/irstlm-6.00.05/src/ngramcache.cpp:135: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(entry + ngsize * sizeof(int),&info,infosize); data/irstlm-6.00.05/src/ngramcache.cpp:145: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(entry,(char*) ngp,sizeof(int) * ngsize); data/irstlm-6.00.05/src/ngramcache.cpp:146: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(entry + ngsize * sizeof(int),&info,infosize); data/irstlm-6.00.05/src/ngramtable.cpp:209: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 header[100]; data/irstlm-6.00.05/src/ngramtable.cpp:228: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 info2[100]; data/irstlm-6.00.05/src/ngramtable.cpp:338: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 ngstring[10000]; data/irstlm-6.00.05/src/ngramtable.cpp:409: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 header[100]; data/irstlm-6.00.05/src/ngramtable.cpp:628: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 header[100]; data/irstlm-6.00.05/src/ngramtable.cpp:709: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(info,"ngram"); data/irstlm-6.00.05/src/ngramtable.cpp:873:3: [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(info,"co-occ%d\n",dstco); data/irstlm-6.00.05/src/ngramtable.cpp:1007: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 w[CODESIZE]; data/irstlm-6.00.05/src/ngramtable.cpp:1061: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[100]; data/irstlm-6.00.05/src/ngramtable.cpp:1063:7: [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(buffer,*tb + idx * sz , sz); data/irstlm-6.00.05/src/ngramtable.cpp:1072:7: [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(*tb + (n-1) * sz , buffer , sz); data/irstlm-6.00.05/src/ngramtable.cpp:1806: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 v[PTRSIZE];; data/irstlm-6.00.05/src/ngramtable.h:145: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 info[100]; //information put in the header data/irstlm-6.00.05/src/ngt.cpp:353: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 info[100]; data/irstlm-6.00.05/src/normcache.cpp:61: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(newcache,cache[n],sizeof(double)*maxcache[n]); data/irstlm-6.00.05/src/plsa.cpp:182:20: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE* f;if ((f=fopen(modelfile,"r"))!=NULL){fclose(f);testmodel=true;} data/irstlm-6.00.05/src/plsa.cpp:219:12: [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 ((f=fopen(modelfile,"r"))!=NULL){fclose(f);testmodel=true;} data/irstlm-6.00.05/src/quantize-lm.cpp:181:20: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). mfstream dummy(tmpfile.c_str(),ios::out); data/irstlm-6.00.05/src/quantize-lm.cpp:186:26: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). createtempfile(dummy,tmpfile,ios::out); data/irstlm-6.00.05/src/quantize-lm.cpp:204:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). out->open(outfile.c_str()); data/irstlm-6.00.05/src/quantize-lm.cpp:217:43: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). std::cerr << "Using temporary file " << tmpfile << std::endl; data/irstlm-6.00.05/src/quantize-lm.cpp:218:20: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). fstream filebuff(tmpfile.c_str(),ios::out|ios::in|ios::binary); data/irstlm-6.00.05/src/quantize-lm.cpp:247: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 line[MAX_LINE]; data/irstlm-6.00.05/src/quantize-lm.cpp:292:22: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). removefile(tmpfile.c_str()); data/irstlm-6.00.05/src/quantize-lm.cpp:294:53: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). ss_msg << "Cannot write in temporary file " << tmpfile << std::endl data/irstlm-6.00.05/src/quantize-lm.cpp:410:14: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). removefile(tmpfile.c_str()); data/irstlm-6.00.05/src/stream-tlm.cpp:220: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 header[BUFSIZ]; data/irstlm-6.00.05/src/stream-tlm.cpp:221: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 filename[BUFSIZ]; data/irstlm-6.00.05/src/stream-tlm.cpp:294: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. char tmpngtfile[BUFSIZ]; data/irstlm-6.00.05/src/tlm.cpp:526: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 afile[50],tfile[50]; data/irstlm-6.00.05/src/util.cpp:65: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[BUFSIZ]; data/irstlm-6.00.05/src/util.cpp:70: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[tmpfolder.size() + 16]; data/irstlm-6.00.05/src/util.cpp:72:2: [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(buffer, "dskbuff--XXXXXX"); data/irstlm-6.00.05/src/util.cpp:73:9: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). int fd=mkstemp(buffer); data/irstlm-6.00.05/src/util.cpp:82:13: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fileStream.open(filePath.c_str(), flags); data/irstlm-6.00.05/src/util.cpp:251: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 line[MAX_LINE]; data/irstlm-6.00.05/src/cmd.c:198: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). for(ProgName=*argv+strlen(*argv); data/irstlm-6.00.05/src/cmd.c:402: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). l = strlen(pfx); data/irstlm-6.00.05/src/cmd.c:407: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). a[0][n] = malloc(strlen(cmd->Name)+strlen(cmd->ArgStr)+l+2); data/irstlm-6.00.05/src/cmd.c:407:38: [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). a[0][n] = malloc(strlen(cmd->Name)+strlen(cmd->ArgStr)+l+2); data/irstlm-6.00.05/src/cmd.c:636:7: [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). l = strlen(Line+offs)-1; data/irstlm-6.00.05/src/cmd.c:860: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). en->Name&&(l!=strlen(en->Name)||strncmp(s, en->Name, l)); data/irstlm-6.00.05/src/cmd.c:1128:12: [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 = 4+strlen(cmd->Name); data/irstlm-6.00.05/src/cmd.c:1156:12: [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 = 4+strlen(cmd->Name), data/irstlm-6.00.05/src/cmd.c:1188:12: [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 = 4+strlen(cmd->Name), data/irstlm-6.00.05/src/cplsa.cpp:306:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)W[i],sizeof(float) * topics); data/irstlm-6.00.05/src/cplsa.cpp:322: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). char *outfname=new char[strlen(fname)+10]; data/irstlm-6.00.05/src/cswam.cpp:156: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). srandom(crc16_ccitt(word,strlen(word))+it); data/irstlm-6.00.05/src/cswam.cpp:419:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char*)&DistMean, sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:420:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char*)&DistVar, sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:421:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char*)&NullProb,sizeof(float)); data/irstlm-6.00.05/src/cswam.cpp:428:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)&TM[e].n,sizeof(int)); data/irstlm-6.00.05/src/cswam.cpp:430:13: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)TM[e].W,sizeof(float) * TM[e].n); data/irstlm-6.00.05/src/cswam.cpp:435:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)TM[e].G[n].M,sizeof(float) * D); data/irstlm-6.00.05/src/cswam.cpp:436:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)TM[e].G[n].S,sizeof(float) * D); data/irstlm-6.00.05/src/dictionary.cpp:89:7: [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(buffer)==(MAX_WORD-1)) { data/irstlm-6.00.05/src/dictionary.cpp:95:7: [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(buffer)==0) { data/irstlm-6.00.05/src/dictionary.cpp:513: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(w)==0) { data/irstlm-6.00.05/src/htable.cpp:72: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). int length=strlen(Key); data/irstlm-6.00.05/src/index.h:10: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). while (i< strlen(str) ) { data/irstlm-6.00.05/src/lmclass.cpp:153:8: [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(line)==MAX_LINE-1) { data/irstlm-6.00.05/src/lmmacro.cpp:244: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). int len = strlen(microW)-1; data/irstlm-6.00.05/src/lmmacro.cpp:783: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). int prev_len = strlen(prev_microtag)-1; data/irstlm-6.00.05/src/lmmacro.cpp:784: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). int curr_len = strlen(curr_microtag)-1; data/irstlm-6.00.05/src/lmmacro.cpp:831: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). int curr_len = strlen(curr_microtag)-1; data/irstlm-6.00.05/src/lmmacro.cpp:854: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). int prev_len = strlen(prev_microtag)-1; data/irstlm-6.00.05/src/lmmacro.cpp:937: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). lexLen=strlen(p); data/irstlm-6.00.05/src/lmmacro.cpp:942:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(curr_NoLexMacro,curr_macro,strlen(curr_macro)-lexLen); data/irstlm-6.00.05/src/lmmacro.cpp:942:38: [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). strncpy(curr_NoLexMacro,curr_macro,strlen(curr_macro)-lexLen); data/irstlm-6.00.05/src/lmtable.cpp:582:8: [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(line)==MAX_LINE-1) { data/irstlm-6.00.05/src/lmtable.cpp:762:8: [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(line)==MAX_LINE-1) { data/irstlm-6.00.05/src/lmtable.cpp:1067:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(succtbl,(table_pos_t) cursize[level+1]*succndsz); data/irstlm-6.00.05/src/lmtable.cpp:1958:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char*)Pcenters[l],NumCenters[l] * sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1961:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)Bcenters[l],NumCenters[l]*sizeof(float)); data/irstlm-6.00.05/src/lmtable.cpp:1996:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(diskid,miniheader,4); data/irstlm-6.00.05/src/lmtable.cpp:2030:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(table[level],(table_pos_t) cursize[level] * nodesize(tbltype[level])); data/irstlm-6.00.05/src/mdiadapt.cpp:1203: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). MY_ASSERT(strlen(filename)<1000); data/irstlm-6.00.05/src/mdiadapt.cpp:1720: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). MY_ASSERT(strlen(filename)<1000); data/irstlm-6.00.05/src/mempool.cpp:248:10: [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 len=strlen(s); data/irstlm-6.00.05/src/mfstream.cpp:40:7: [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(cmode,"r"); data/irstlm-6.00.05/src/mfstream.cpp:42:7: [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(cmode,"w"); data/irstlm-6.00.05/src/mfstream.cpp:44:7: [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(cmode,"a"); data/irstlm-6.00.05/src/mfstream.cpp:109:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if(!read((char *)p, sz * n)) return *this; data/irstlm-6.00.05/src/mfstream.cpp:156: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(_cmdname)>0) { data/irstlm-6.00.05/src/mfstream.cpp:157: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). char *a=new char[strlen(_cmdname)+1]; data/irstlm-6.00.05/src/mfstream.h:40:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t read (int fd, void* buf, size_t num); data/irstlm-6.00.05/src/mfstream.h:107:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). num = read (fd, buffer+4, bufferSize-4); data/irstlm-6.00.05/src/mfstream.h:127:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(fd,s,num); data/irstlm-6.00.05/src/n_gram.cpp:130:7: [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(w)==(MAX_WORD-1)) data/irstlm-6.00.05/src/n_gram.cpp:247:7: [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(w)==(MAX_WORD-1)) data/irstlm-6.00.05/src/ngramtable.cpp:377:21: [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(ngstring," "); data/irstlm-6.00.05/src/ngramtable.cpp:380:84: [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). out << ngstring << "\t" << ng.freq << "\t" << crc16_ccitt(ngstring,strlen(ngstring)) << "\n"; data/irstlm-6.00.05/src/ngramtable.cpp:555:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+WORD_OFFS,CODESIZE); data/irstlm-6.00.05/src/ngramtable.cpp:566:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+offs,1 * frnum); data/irstlm-6.00.05/src/ngramtable.cpp:568:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+offs,2 * frnum); data/irstlm-6.00.05/src/ngramtable.cpp:570:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+offs,3 * frnum); data/irstlm-6.00.05/src/ngramtable.cpp:572:11: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+offs,4 * frnum); data/irstlm-6.00.05/src/ngramtable.cpp:578:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+FLAGS_OFFS,CHARSIZE); data/irstlm-6.00.05/src/ngramtable.cpp:582:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read(nd+MSUCC_OFFS,CODESIZE); data/irstlm-6.00.05/src/ngramtable.cpp:613:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)&treeflags,CHARSIZE); data/irstlm-6.00.05/src/ngramtable.cpp:636:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). inp.read((char *)&treeflags,CHARSIZE); data/irstlm-6.00.05/src/ngramtable.cpp:730:22: [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 (size_t c=0; c<strlen(hmask); c++) { data/irstlm-6.00.05/src/ngt.cpp:310: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). for (size_t c=0; c<strlen(hmask); c++) { data/irstlm-6.00.05/src/quantize-lm.cpp:259:42: [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(line, "\\data\\", 6) || strlen(line)==0) data/irstlm-6.00.05/src/util.cpp:254: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(line)==MAX_LINE-1) { ANALYSIS SUMMARY: Hits = 351 Lines analyzed = 26528 in approximately 0.78 seconds (34120 lines/second) Physical Source Lines of Code (SLOC) = 17537 Hits@level = [0] 123 [1] 69 [2] 194 [3] 9 [4] 79 [5] 0 Hits@level+ = [0+] 474 [1+] 351 [2+] 282 [3+] 88 [4+] 79 [5+] 0 Hits/KSLOC@level+ = [0+] 27.0286 [1+] 20.0148 [2+] 16.0803 [3+] 5.01796 [4+] 4.50476 [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.