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/roguenarok-1.0/Array.c Examining data/roguenarok-1.0/Array.h Examining data/roguenarok-1.0/BitVector.c Examining data/roguenarok-1.0/Dropset.c Examining data/roguenarok-1.0/Dropset.h Examining data/roguenarok-1.0/HashTable.c Examining data/roguenarok-1.0/HashTable.h Examining data/roguenarok-1.0/List.c Examining data/roguenarok-1.0/List.h Examining data/roguenarok-1.0/Node.c Examining data/roguenarok-1.0/Node.h Examining data/roguenarok-1.0/ProfileElem.c Examining data/roguenarok-1.0/ProfileElem.h Examining data/roguenarok-1.0/RogueNaRok.c Examining data/roguenarok-1.0/Tree.c Examining data/roguenarok-1.0/Tree.h Examining data/roguenarok-1.0/common.c Examining data/roguenarok-1.0/legacy.c Examining data/roguenarok-1.0/legacy.h Examining data/roguenarok-1.0/newFunctions.c Examining data/roguenarok-1.0/newFunctions.h Examining data/roguenarok-1.0/parallel.c Examining data/roguenarok-1.0/rnr-lsi.c Examining data/roguenarok-1.0/rnr-mast.c Examining data/roguenarok-1.0/rnr-prune.c Examining data/roguenarok-1.0/rnr-tii.c Examining data/roguenarok-1.0/sharedVariables.h Examining data/roguenarok-1.0/BitVector.h Examining data/roguenarok-1.0/common.h Examining data/roguenarok-1.0/parallel.h FINAL RESULTS: data/roguenarok-1.0/RogueNaRok.c:2185: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(run_id, optarg); data/roguenarok-1.0/RogueNaRok.c:2197: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(workdir, optarg) ; data/roguenarok-1.0/Tree.c:129: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(p->word, s); data/roguenarok-1.0/Tree.c:189:8: [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(nameList[taxaCount], buffer); data/roguenarok-1.0/Tree.c:675:4: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(treestr, "%s", nameptr); data/roguenarok-1.0/Tree.c:737:6: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(treestr, "%s", "\0"); data/roguenarok-1.0/common.c:144: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(result, workdir); data/roguenarok-1.0/common.c:145:3: [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(result, programName); data/roguenarok-1.0/common.c:148:3: [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(result, run_id); data/roguenarok-1.0/common.c:184: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(result, workdir); data/roguenarok-1.0/common.c:185:3: [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(result, programName); data/roguenarok-1.0/common.c:187:3: [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(result, fileName); data/roguenarok-1.0/common.c:189:3: [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(result, run_id); data/roguenarok-1.0/common.c:217:3: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(f, format, args ); data/roguenarok-1.0/common.c:221:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, args ); data/roguenarok-1.0/newFunctions.c:44:7: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. sscanf(line, "%s\n", bla); data/roguenarok-1.0/rnr-lsi.c:362: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(run_id, optarg); data/roguenarok-1.0/rnr-lsi.c:365: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(workdir, optarg); data/roguenarok-1.0/rnr-mast.c:911: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(run_id, optarg); data/roguenarok-1.0/rnr-mast.c:920: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(workdir, optarg); data/roguenarok-1.0/rnr-prune.c:179: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(workdir,optarg); data/roguenarok-1.0/rnr-prune.c:182: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(run_id,optarg); data/roguenarok-1.0/rnr-tii.c:281: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(run_id, optarg); data/roguenarok-1.0/rnr-tii.c:287: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(workdir, optarg); data/roguenarok-1.0/RogueNaRok.c:2165:15: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt (argc, argv, "i:t:n:x:whc:s:bT:L:")) != -1) data/roguenarok-1.0/rnr-lsi.c:354:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt (argc, argv, "hi:n:w:m:x:")) != -1) data/roguenarok-1.0/rnr-mast.c:903:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt (argc, argv, "hi:n:aw:x:")) != -1) data/roguenarok-1.0/rnr-prune.c:171:14: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while((c = getopt(argc,argv, "hi:t:x:n:")) != -1) data/roguenarok-1.0/rnr-tii.c:273:16: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((c = getopt (argc, argv, "hi:n:x:w:z:")) != -1) data/roguenarok-1.0/Array.h: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(result->arrayTable, array->arrayTable, array->length * sizeof(TYPE) ); \ data/roguenarok-1.0/Array.h:55: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(result->commonAttributes, array->commonAttributes, sizeof(TYPEATTR) ) ; \ data/roguenarok-1.0/BitVector.c:125: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(result, bitVector,bitVectorLength * sizeof(BitVector)); data/roguenarok-1.0/BitVector.h:52:29: [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. __attribute__((__common__)) char bits_in_16bits [0x1u << 16]; data/roguenarok-1.0/ProfileElem.c:68:30: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. result->commonAttributes = memcpy(result->commonAttributes, profile->commonAttributes, sizeof(ProfileElemAttr)); data/roguenarok-1.0/Tree.c:142: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 data/roguenarok-1.0/Tree.c:601: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 str[nmlngth+2]; data/roguenarok-1.0/Tree.c:678:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(treestr, "%d", p->number); data/roguenarok-1.0/Tree.c:702:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(treestr, ":0.0;\n"); data/roguenarok-1.0/Tree.c:704:2: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(treestr, ";\n"); data/roguenarok-1.0/Tree.c:716: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(treestr, "%d:%8.20f", p->bInf->support, p->z[0]); data/roguenarok-1.0/Tree.c:718: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(treestr, ":%8.20f[%d]", p->z[0], p->bInf->support); data/roguenarok-1.0/Tree.c:720: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(treestr, ":%8.20f[%d]", getBranchLength(tr, perGene, p), p->bInf->support); data/roguenarok-1.0/Tree.c:726: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(treestr, ":%8.20f", p->z[0]); data/roguenarok-1.0/Tree.c:728: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(treestr, ":%8.20f", getBranchLength(tr, perGene, p)); data/roguenarok-1.0/Tree.c:735:6: [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(treestr, ":%8.20f", p->z[0]); data/roguenarok-1.0/Tree.c:985: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 label[64]; data/roguenarok-1.0/Tree.c:1244: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(e->bitVector, bitVector, sizeof(unsigned int) * vectorLength); data/roguenarok-1.0/Tree.c:1262: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(e->bitVector, bitVector, sizeof(unsigned int) * vectorLength); data/roguenarok-1.0/Tree.c:1286: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(e->bitVector, bitVector, sizeof(unsigned int) * vectorLength); data/roguenarok-1.0/Tree.c:1362: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(e->bitVector, bitVector, sizeof(unsigned int) * vectorLength); data/roguenarok-1.0/Tree.c:1379: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(e->bitVector, bitVector, sizeof(unsigned int) * vectorLength); data/roguenarok-1.0/common.c:86: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). fp = fopen(filename,"rb"); data/roguenarok-1.0/common.c:110:14: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). FILE *fp = fopen(path, mode); data/roguenarok-1.0/common.c:146: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(result, "_info"); data/roguenarok-1.0/common.c:183: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 result[1024]; data/roguenarok-1.0/legacy.c:141:23: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. result->bitVector = memcpy(result->bitVector, helem->bitVector, vectorLength * sizeof(BitVector)); data/roguenarok-1.0/legacy.c:142:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. result->treeVector = memcpy(result->treeVector, helem->treeVector, treeVectorLength * sizeof(BitVector)); data/roguenarok-1.0/legacy.h:66: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 xs[NUM_BRANCHES]; data/roguenarok-1.0/newFunctions.c:38: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 data/roguenarok-1.0/newFunctions.c:43:7: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char bla[1024]; data/roguenarok-1.0/rnr-prune.c:55:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. extern char run_id[128]; data/roguenarok-1.0/sharedVariables.h:40:8: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. extern char *infoFileName, data/roguenarok-1.0/RogueNaRok.c:1838: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(treeFile)) data/roguenarok-1.0/Tree.c:127: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). p->word = (char *)malloc((strlen(s) + 1) * sizeof(char)); data/roguenarok-1.0/Tree.c:154:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((c = fgetc(f)) != ';') data/roguenarok-1.0/Tree.c:158:8: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(f); data/roguenarok-1.0/Tree.c:168:9: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = fgetc(f); data/roguenarok-1.0/Tree.c:188:60: [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). nameList[taxaCount] = (char*)malloc(sizeof(char) * (strlen(buffer) + 1)); data/roguenarok-1.0/Tree.c:525:8: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(fp); data/roguenarok-1.0/Tree.c:532:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(fp); data/roguenarok-1.0/Tree.c:542:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(fp); data/roguenarok-1.0/Tree.c:551:12: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = getc(fp); data/roguenarok-1.0/Tree.c:881:26: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (n > 0 && ((ch = getc(fp1)) != EOF)) { data/roguenarok-1.0/Tree.c:899:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(fp)) != EOF && ch != ']') { data/roguenarok-1.0/Tree.c:916:16: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((ch = getc(fp)) != EOF) { data/roguenarok-1.0/Tree.c:1044:13: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((cc=getc(f))!='\n') i++; data/roguenarok-1.0/Tree.c:1397:15: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while((ch = fgetc(f)) != EOF) data/roguenarok-1.0/common.c:147:3: [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(result, "."); data/roguenarok-1.0/common.c:168: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). stringLength = strlen(string); data/roguenarok-1.0/common.c:186:3: [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(result, "_"); data/roguenarok-1.0/common.c:188:3: [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(result, "."); data/roguenarok-1.0/newFunctions.c:81: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(toDrop) == 0) ANALYSIS SUMMARY: Hits = 82 Lines analyzed = 9121 in approximately 0.22 seconds (40852 lines/second) Physical Source Lines of Code (SLOC) = 6463 Hits@level = [0] 134 [1] 20 [2] 33 [3] 5 [4] 24 [5] 0 Hits@level+ = [0+] 216 [1+] 82 [2+] 62 [3+] 29 [4+] 24 [5+] 0 Hits/KSLOC@level+ = [0+] 33.421 [1+] 12.6876 [2+] 9.59307 [3+] 4.48708 [4+] 3.71345 [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.