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/proda-1.0/Block.h Examining data/proda-1.0/Consistency.h Examining data/proda-1.0/GlobalAlign.h Examining data/proda-1.0/LinkTable.h Examining data/proda-1.0/LocalAlign.h Examining data/proda-1.0/Matrix.h Examining data/proda-1.0/MultiSequence.h Examining data/proda-1.0/PairAligner.h Examining data/proda-1.0/ProbModel.h Examining data/proda-1.0/Score.h Examining data/proda-1.0/ScoreMatrix.h Examining data/proda-1.0/Sequence.h Examining data/proda-1.0/SparseMatrix.h Examining data/proda-1.0/Tree.h Examining data/proda-1.0/Types.h Examining data/proda-1.0/Utilities.h Examining data/proda-1.0/Consistency.cc Examining data/proda-1.0/GlobalAlign.cc Examining data/proda-1.0/LocalAlign.cc Examining data/proda-1.0/Matrix.cc Examining data/proda-1.0/Score.cc Examining data/proda-1.0/ScoreMatrix.cc Examining data/proda-1.0/Sequence.cc Examining data/proda-1.0/SparseMatrix.cc Examining data/proda-1.0/Tree.cc Examining data/proda-1.0/Utilities.cc Examining data/proda-1.0/Assert.cc Examining data/proda-1.0/Assert.h Examining data/proda-1.0/MultiSequence.cc Examining data/proda-1.0/AlignedFragment.cc Examining data/proda-1.0/AlignedFragment.h Examining data/proda-1.0/Block.cc Examining data/proda-1.0/PairAligner.cc Examining data/proda-1.0/ProbModel.cc Examining data/proda-1.0/Main.cc FINAL RESULTS: data/proda-1.0/Main.cc:211: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(file0,filenames[0]); data/proda-1.0/MultiSequence.cc:242:13: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. res = sscanf (ptr + 5, "%s", temp); data/proda-1.0/MultiSequence.cc:316:5: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat (data[foundSequence - numSequences + numRead], text); data/proda-1.0/AlignedFragment.cc:191: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(s,seq[k]+b[k],sizeof(int)*(end[k]-begin[k]+1-b[k]-e[k])); data/proda-1.0/GlobalAlign.cc:109: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 (newName, seq.GetName(), strlen(seq.GetName())+1); data/proda-1.0/Main.cc:210: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 file0[260]; data/proda-1.0/Main.cc:216:4: [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(file0,".fasta"); data/proda-1.0/Main.cc:217: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). fasta = fopen(file0,"w"); data/proda-1.0/Main.cc:219: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(file0,".test"); data/proda-1.0/Main.cc:220:18: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *output = fopen(file0,"w"); data/proda-1.0/Matrix.cc:38: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 (data, m.data, sizeof(float) * (layers * rows * cols)); data/proda-1.0/MultiSequence.cc:116:18: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. if (sequences) memcpy (temp, sequences, sizeof(SequencePtr) * numSequences); data/proda-1.0/MultiSequence.cc:134:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen (filename, "r"); data/proda-1.0/MultiSequence.cc:157:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen (filename, "r"); data/proda-1.0/MultiSequence.cc:176: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 (temp, name+1, sizeof(char) * length); data/proda-1.0/MultiSequence.cc:199: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 (temp+1, data, sizeof(char) * (length+1)); data/proda-1.0/MultiSequence.cc:222:16: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *file = fopen (filename, "r"); data/proda-1.0/MultiSequence.cc:246: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 (name, temp, sizeof(char) * (strlen(temp)+1)); data/proda-1.0/MultiSequence.cc:389:16: [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 const char *groups[47] = { data/proda-1.0/ProbModel.cc:1036: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(ij,buf,sizeof(SCORE)*NUM_STATES); data/proda-1.0/ProbModel.cc:1105: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(ij,buf,sizeof(SCORE)*NUM_STATES); data/proda-1.0/ProbModel.cc:1167: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(ij,buf,sizeof(SCORE)*NUM_STATES); data/proda-1.0/ProbModel.cc:1225: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(ij,buf,sizeof(SCORE)*NUM_STATES); data/proda-1.0/ScoreMatrix.cc:39: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 (data, m.data, sizeof(SCORE) * (layers * rows * cols)); data/proda-1.0/Sequence.cc:38: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 (data, rhs.data, sizeof(char) * (length+2)); data/proda-1.0/Sequence.cc:41: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 (align, rhs.align, sizeof(int) * (length+1)); data/proda-1.0/Sequence.cc:44: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 (position, rhs.position, sizeof(int) * (length+1)); data/proda-1.0/Sequence.cc:50: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 (name, rhs.name, sizeof(char) * (strlen(rhs.name)+1)); data/proda-1.0/Sequence.cc:71: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 (data, rhs.data, sizeof(char) * (length+2)); data/proda-1.0/Sequence.cc:74: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 (align, rhs.align, sizeof(int) * (length+1)); data/proda-1.0/Sequence.cc:77: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 (position, rhs.position, sizeof(int) * (length+1)); data/proda-1.0/Sequence.cc:83: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 (name, rhs.name, sizeof(char) * (strlen(rhs.name)+1)); data/proda-1.0/Sequence.cc:221: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 (tmp+1, data+begin, sizeof(char)*length); data/proda-1.0/Sequence.cc:243: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 (d+1, data+begin, sizeof(char)*(length+1)); data/proda-1.0/Sequence.cc:248: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 (p+1, position + begin,sizeof(int)*(length)); data/proda-1.0/Sequence.cc:252: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 (a, align + begin,sizeof(int)*(length+1)); data/proda-1.0/Utilities.cc:64: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, temp, sizeof(char) * length); data/proda-1.0/Utilities.cc:77: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 (buffer, temp, sizeof(char) * length); data/proda-1.0/Utilities.cc:92: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 (ret, s, len+1); data/proda-1.0/Utilities.cc:105: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 (ret, s + i, j - i); data/proda-1.0/GlobalAlign.cc:90:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen (alignmentPath); data/proda-1.0/GlobalAlign.cc:95:28: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *newName = new char[strlen(seq.GetName())+1]; data/proda-1.0/GlobalAlign.cc:109:35: [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). memcpy (newName, seq.GetName(), strlen(seq.GetName())+1); data/proda-1.0/Main.cc:212: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). for(i = strlen(file0)-1; i > 0 && file0[i]!='.'; i--); data/proda-1.0/MultiSequence.cc:244:29: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). char *name = new char[strlen(temp)+1]; data/proda-1.0/MultiSequence.cc:246:43: [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). memcpy (name, temp, sizeof(char) * (strlen(temp)+1)); data/proda-1.0/MultiSequence.cc:278:5: [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 (data[i], "@"); data/proda-1.0/MultiSequence.cc:429: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 nameLength = strlen(sequences[0]->GetName()); data/proda-1.0/MultiSequence.cc:433:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nameLength = max (nameLength, (int) strlen(sequences[i]->GetName())); data/proda-1.0/MultiSequence.cc:649: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 nameLength = strlen(sequences[0]->GetName()); data/proda-1.0/MultiSequence.cc:653:41: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nameLength = max (nameLength, (int) strlen(sequences[i]->GetName())); data/proda-1.0/Sequence.cc:37: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). ASSERT (length + 1 == (int) strlen(rhs.data), "Sequence of incorrect length."); data/proda-1.0/Sequence.cc:48: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). name = new char[strlen(rhs.name)+1]; data/proda-1.0/Sequence.cc:50:45: [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). memcpy (name, rhs.name, sizeof(char) * (strlen(rhs.name)+1)); data/proda-1.0/Sequence.cc:81:23: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). name = new char[strlen(rhs.name)+1]; data/proda-1.0/Sequence.cc:83:47: [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). memcpy (name, rhs.name, sizeof(char) * (strlen(rhs.name)+1)); data/proda-1.0/Sequence.cc:140:18: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). this->length = strlen(data) - 1; data/proda-1.0/Utilities.cc:48:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). {for (int i = strlen(terminatingChars) - 1; i >= 0; i--) data/proda-1.0/Utilities.cc:50:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). {for (int i = strlen(skipChars) - 1; i >= 0; i--) data/proda-1.0/Utilities.cc:55:16: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = fgetc (file)) != EOF){ data/proda-1.0/Utilities.cc:89:13: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). int len = strlen(s); data/proda-1.0/Utilities.cc:101:32: [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). ASSERT (i >= 0 && i <= (int) strlen(s), "Invalid index."); data/proda-1.0/Utilities.cc:102:32: [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). ASSERT (j >= i && j <= (int) strlen(s), "Invalid index."); ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 6341 in approximately 0.21 seconds (30649 lines/second) Physical Source Lines of Code (SLOC) = 4424 Hits@level = [0] 98 [1] 23 [2] 37 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 161 [1+] 63 [2+] 40 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 36.3924 [1+] 14.2405 [2+] 9.04159 [3+] 0.678119 [4+] 0.678119 [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.