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/ncbi-seg-0.0.20000620/lnfac.h Examining data/ncbi-seg-0.0.20000620/hiseg.c Examining data/ncbi-seg-0.0.20000620/genwin.h Examining data/ncbi-seg-0.0.20000620/debian/patches/genwin.c Examining data/ncbi-seg-0.0.20000620/debian/patches/seg.c Examining data/ncbi-seg-0.0.20000620/seg.c Examining data/ncbi-seg-0.0.20000620/genwin.c FINAL RESULTS: data/ncbi-seg-0.0.20000620/genwin.c:97:7: [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(dbase->filename, blastdir); data/ncbi-seg-0.0.20000620/genwin.c:98:7: [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(dbase->filename, name); data/ncbi-seg-0.0.20000620/genwin.c:99:7: [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(dbase->indexname, indexdir); data/ncbi-seg-0.0.20000620/genwin.c:100:7: [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(dbase->indexname, name); data/ncbi-seg-0.0.20000620/genwin.c:106:7: [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(dbase->filename, name); data/ncbi-seg-0.0.20000620/genwin.c:107:7: [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(dbase->indexname, name); data/ncbi-seg-0.0.20000620/hiseg.c:709:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, format, 1); data/ncbi-seg-0.0.20000620/hiseg.c:715:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, format, i+1); data/ncbi-seg-0.0.20000620/seg.c:697:2: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, format, 1); data/ncbi-seg-0.0.20000620/seg.c:703:4: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. fprintf(stdout, format, i+1); data/ncbi-seg-0.0.20000620/hiseg.c:135: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(nargc, nargv, "m:olhaxpqc:nt:"))!=-1) data/ncbi-seg-0.0.20000620/seg.c:137: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(nargc, nargv, "m:olhaxpqc:nt:"))!=-1) data/ncbi-seg-0.0.20000620/genwin.c:44:10: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. unsigned char aaflag[128]; data/ncbi-seg-0.0.20000620/genwin.c:45:1: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char aachar[20]; data/ncbi-seg-0.0.20000620/genwin.c:49: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 string[STRSIZE]; data/ncbi-seg-0.0.20000620/genwin.c:114:24: [2] (misc) fopen: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). else if ((dbase->fp=fopen(dbase->filename, "r"))==NULL) data/ncbi-seg-0.0.20000620/genwin.c:240: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(win->seq, (parent->seq)+start, length); data/ncbi-seg-0.0.20000620/genwin.c:622: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(seq->id, bptr, idend); data/ncbi-seg-0.0.20000620/genwin.c:640: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(seq->name, bptr, namend); data/ncbi-seg-0.0.20000620/genwin.c:659: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(seq->organism, bptr, orgend); data/ncbi-seg-0.0.20000620/hiseg.c:110: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). window = atoi(argv[2]); data/ncbi-seg-0.0.20000620/hiseg.c:140:24: [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). hilenmin = atoi(optarg); data/ncbi-seg-0.0.20000620/hiseg.c:187:24: [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). charline = atoi(optarg); data/ncbi-seg-0.0.20000620/hiseg.c:193:23: [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). maxtrim = atoi(optarg); data/ncbi-seg-0.0.20000620/hiseg.c:681: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 format[10]; data/ncbi-seg-0.0.20000620/hiseg.c:687: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(format, "%%%dd ", leftspace); data/ncbi-seg-0.0.20000620/hiseg.c:737: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], leftfmt[20], rightfmt[20]; data/ncbi-seg-0.0.20000620/hiseg.c:746: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(leftfmt, "%%%ds", cline); data/ncbi-seg-0.0.20000620/hiseg.c:747: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(rightfmt, "%%-%ds", cline); data/ncbi-seg-0.0.20000620/hiseg.c:853: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 outbuf[HDRLEN+1]; data/ncbi-seg-0.0.20000620/seg.c:111: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). window = atoi(argv[2]); data/ncbi-seg-0.0.20000620/seg.c:142:24: [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). hilenmin = atoi(optarg); data/ncbi-seg-0.0.20000620/seg.c:189:24: [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). charline = atoi(optarg); data/ncbi-seg-0.0.20000620/seg.c:195:23: [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). maxtrim = atoi(optarg); data/ncbi-seg-0.0.20000620/seg.c:669: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 format[10]; data/ncbi-seg-0.0.20000620/seg.c:675: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(format, "%%%dd ", leftspace); data/ncbi-seg-0.0.20000620/seg.c:725: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], leftfmt[20], rightfmt[20]; data/ncbi-seg-0.0.20000620/seg.c:734: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(leftfmt, "%%%ds", cline); data/ncbi-seg-0.0.20000620/seg.c:735: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(rightfmt, "%%-%ds", cline); data/ncbi-seg-0.0.20000620/seg.c:841: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 outbuf[HDRLEN+1]; data/ncbi-seg-0.0.20000620/genwin.c:95: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). dbase->filename = (char *) malloc(strlen(blastdir)+strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:95:58: [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). dbase->filename = (char *) malloc(strlen(blastdir)+strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:96: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). dbase->indexname = (char *) malloc(strlen(indexdir)+strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:96:59: [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). dbase->indexname = (char *) malloc(strlen(indexdir)+strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:104: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). dbase->filename = (char *) malloc(strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:105: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). dbase->indexname = (char *) malloc(strlen(name)+1); data/ncbi-seg-0.0.20000620/genwin.c:516:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(dbase->fp); data/ncbi-seg-0.0.20000620/genwin.c:523:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c=getc(dbase->fp)) != EOF && c !='\n') data/ncbi-seg-0.0.20000620/genwin.c:555:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c=getc(fp)) == EOF) data/ncbi-seg-0.0.20000620/genwin.c:563:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(fp); data/ncbi-seg-0.0.20000620/genwin.c:575:24: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (i=0,itotal=0,c=getc(fp); c != EOF; c=getc(fp)) data/ncbi-seg-0.0.20000620/genwin.c:575:46: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (i=0,itotal=0,c=getc(fp); c != EOF; c=getc(fp)) data/ncbi-seg-0.0.20000620/genwin.c:665:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). c = getc(fp); data/ncbi-seg-0.0.20000620/genwin.c:689:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c=getc(fp))!='\n' && c!=EOF) data/ncbi-seg-0.0.20000620/genwin.c:734:30: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (i = 0, itotal = 0, c = getc(fp); c != EOF; c = getc(fp)) { data/ncbi-seg-0.0.20000620/genwin.c:734:54: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (i = 0, itotal = 0, c = getc(fp); c != EOF; c = getc(fp)) { data/ncbi-seg-0.0.20000620/genwin.c:788:16: [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). seq->length = strlen(seq->seq); data/ncbi-seg-0.0.20000620/hiseg.c:884: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). i = MIN(HDRLEN, strlen(header)); data/ncbi-seg-0.0.20000620/seg.c:872: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). i = MIN(HDRLEN, strlen(header)); ANALYSIS SUMMARY: Hits = 59 Lines analyzed = 4322 in approximately 0.23 seconds (18488 lines/second) Physical Source Lines of Code (SLOC) = 3489 Hits@level = [0] 41 [1] 19 [2] 28 [3] 2 [4] 10 [5] 0 Hits@level+ = [0+] 100 [1+] 59 [2+] 40 [3+] 12 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 28.6615 [1+] 16.9103 [2+] 11.4646 [3+] 3.43938 [4+] 2.86615 [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.