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/toppred-1.10/src/charge.c
Examining data/toppred-1.10/src/charge.h
Examining data/toppred-1.10/src/error.c
Examining data/toppred-1.10/src/error.h
Examining data/toppred-1.10/src/graph.c
Examining data/toppred-1.10/src/graph.h
Examining data/toppred-1.10/src/loop.c
Examining data/toppred-1.10/src/loop.h
Examining data/toppred-1.10/src/main.c
Examining data/toppred-1.10/src/main.h
Examining data/toppred-1.10/src/mloutput.c
Examining data/toppred-1.10/src/mloutput.h
Examining data/toppred-1.10/src/output.c
Examining data/toppred-1.10/src/output.h
Examining data/toppred-1.10/src/params.h
Examining data/toppred-1.10/src/profile.c
Examining data/toppred-1.10/src/profile.h
Examining data/toppred-1.10/src/seq-reader.c
Examining data/toppred-1.10/src/seq-reader.h
Examining data/toppred-1.10/src/topology.c
Examining data/toppred-1.10/src/topology.h
Examining data/toppred-1.10/src/topoprint.c
Examining data/toppred-1.10/src/topoprint.h
Examining data/toppred-1.10/src/usage.c
Examining data/toppred-1.10/src/usage.h

FINAL RESULTS:

data/toppred-1.10/src/graph.c:94:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  (void)sprintf(p, "%s", legend_text);
data/toppred-1.10/src/graph.c:347:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  (void)sprintf(p, "%s/%s-%d.png",dir, title, num);
data/toppred-1.10/src/main.c:484:12:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
	    (void)sprintf(topo2prn.image, "%s-%d.%s",
data/toppred-1.10/src/mloutput.c:34:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  (void)sprintf(filename, "%s/%s.html", dir, name);
data/toppred-1.10/src/profile.c:234:10:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
   (void)sprintf(filename, "%s/%s.hydro",dir, id);
data/toppred-1.10/src/profile.c:355:9:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  (void)sprintf(gnuplot_command, "gnuplot %s", tempfilename);
data/toppred-1.10/src/profile.c:357: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.
  if(system(gnuplot_command) == -1){
data/toppred-1.10/src/main.c:79:19:  [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.
  if ((data_dir = getenv("TOPPREDDATA")) == NULL){
data/toppred-1.10/src/main.c:94: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((i = getopt(argc, argv, "c:d:eg:hH:n:N:o:O:p:q:s:t:vy")) != -1) {
data/toppred-1.10/src/charge.c:209:13:  [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 ((IN = fopen(file, "r")) == NULL)
data/toppred-1.10/src/graph.c:107:13:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
      (void)sprintf(p, "%3d", element[i].tm.nr);
data/toppred-1.10/src/graph.c:194:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  (void)sprintf(legend1, "Ll = %d", length);
data/toppred-1.10/src/graph.c:195:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  (void)sprintf(legend2, "KR = %d", kr);
data/toppred-1.10/src/graph.c:263:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  (void)sprintf(tag, "%d", n);
data/toppred-1.10/src/graph.c:349:17:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  if ((pngout = fopen(file_name, "wb")) == NULL) {
data/toppred-1.10/src/graph.c:415:9:  [2] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf. Risk is low because the source has a constant maximum length.
  (void)sprintf(struct_num, "Structure no. %d", num);
data/toppred-1.10/src/main.c:102: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).
      params.tmspacer = atoi(optarg);
data/toppred-1.10/src/main.c:133: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).
      params.n = atoi(optarg);
data/toppred-1.10/src/main.c:137: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).
      params.n_topos = atoi(optarg);
data/toppred-1.10/src/main.c:153: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).
      params.q = atoi(optarg);
data/toppred-1.10/src/main.c:157: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).
      params.seg_len = atoi(optarg);
data/toppred-1.10/src/main.c:208:40:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  if(out_file != NULL && (params.OUT = fopen(out_file, "w")) == NULL)
data/toppred-1.10/src/main.c:257:34:  [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 (*argv[i] != '-' && (IN = fopen(argv[i], "r")) == NULL)
data/toppred-1.10/src/mloutput.c:36: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).
  if ((OUT = fopen(filename, "w")) == NULL) {
data/toppred-1.10/src/profile.c:51:13:  [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 ((IN = fopen(file, "r")) == NULL)
data/toppred-1.10/src/profile.c:235: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((OUT=fopen(filename, "w")) == NULL){
data/toppred-1.10/src/profile.c:300:11:  [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).
  if((j = mkstemp(tempfilename)) == -1){
data/toppred-1.10/src/seq-reader.c:70: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(q, BUFF, BUFFSIZE+1);
data/toppred-1.10/src/seq-reader.c:225: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 err_aa[2];
data/toppred-1.10/src/charge.c:54:14:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  if (eoff > strlen (seq))
data/toppred-1.10/src/charge.c:82:14:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  if (eoff > strlen (seq)){
data/toppred-1.10/src/charge.c:97: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(seq) > 2 && strchr("KRLFI", seq[1]) == NULL) return 1;
data/toppred-1.10/src/charge.c:168:9:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(seq);
data/toppred-1.10/src/graph.c: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).
  i = strlen(legend_text) + n*3;
data/toppred-1.10/src/graph.c:95: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).
  p+=strlen(legend_text);
data/toppred-1.10/src/graph.c:199: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).
    xf1 = xc - strlen(legend1)*font->w/2;
data/toppred-1.10/src/graph.c:200: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).
    xf2 = xc - strlen(legend2)*font->w/2;
data/toppred-1.10/src/graph.c:207: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).
    xf1 = xc - strlen(legend1)*font->w;
data/toppred-1.10/src/graph.c:208: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).
    xf2 = xc - strlen(legend2)*font->w;
data/toppred-1.10/src/graph.c:265: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).
  num_l=(strlen(tag) * font->w) /2 ;
data/toppred-1.10/src/graph.c:342: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).
  path_len =sizeof(char) * (strlen(dir) + 1 + strlen(title) + 6 + 5 + 2 + 1 );
data/toppred-1.10/src/graph.c:342: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).
  path_len =sizeof(char) * (strlen(dir) + 1 + strlen(title) + 6 + 5 + 2 + 1 );
data/toppred-1.10/src/graph.c:399: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).
  text_l = (strlen(cyto) * font->w) /2 ;
data/toppred-1.10/src/graph.c:405: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).
  text_l = (strlen(extra) * font->w) /2 ;
data/toppred-1.10/src/main.c:227:9:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(data_dir) + 1 + strlen(params.data_file) + 1;
data/toppred-1.10/src/main.c:227: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).
  len = strlen(data_dir) + 1 + strlen(params.data_file) + 1;
data/toppred-1.10/src/main.c:235:9:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(data_dir) + 1 + strlen(params.ce_file) + 1;
data/toppred-1.10/src/main.c:235: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).
  len = strlen(data_dir) + 1 + strlen(params.ce_file) + 1;
data/toppred-1.10/src/main.c:378: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).
    if(!params.plot_outfile && strlen(params.plot_pause) != 0) {
data/toppred-1.10/src/main.c:481: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).
	    int image_len = strlen(seq.id) + strlen(params.topo_format) + 6 + 3;
data/toppred-1.10/src/main.c:481:39:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
	    int image_len = strlen(seq.id) + strlen(params.topo_format) + 6 + 3;
data/toppred-1.10/src/mloutput.c:29:9:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(dir) + 1 + strlen(name) + 5;
data/toppred-1.10/src/mloutput.c:29:27:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(dir) + 1 + strlen(name) + 5;
data/toppred-1.10/src/profile.c:230: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).
  len =  strlen(dir) + 1 + strlen(id) + 6 + 1;
data/toppred-1.10/src/profile.c:230: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).
  len =  strlen(dir) + 1 + strlen(id) + 6 + 1;
data/toppred-1.10/src/seq-reader.c:34:12:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  if ((i = fgetc(IN)) == EOF && feof(IN) != 0) {
data/toppred-1.10/src/seq-reader.c:52:15:  [1] (buffer) fgetc:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
  while ((i = fgetc(IN)) != EOF) {
data/toppred-1.10/src/seq-reader.c:102:7:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
      strncpy (q, BUFF, bufflen);
data/toppred-1.10/src/seq-reader.c:196:37:  [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((comm = malloc(sizeof(char) * (strlen(header) - n))) == NULL){
data/toppred-1.10/src/topoprint.c:50:9:  [1] (buffer) strlen:
  Does not handle strings that are not \0-terminated; if given one it may
  perform an over-read (it could cause a crash if unprotected) (CWE-126).
  len = strlen(seq);

ANALYSIS SUMMARY:

Hits = 60
Lines analyzed = 3615 in approximately 0.13 seconds (27840 lines/second)
Physical Source Lines of Code (SLOC) = 2342
Hits@level = [0] 175 [1]  31 [2]  20 [3]   2 [4]   7 [5]   0
Hits@level+ = [0+] 235 [1+]  60 [2+]  29 [3+]   9 [4+]   7 [5+]   0
Hits/KSLOC@level+ = [0+] 100.342 [1+] 25.6191 [2+] 12.3826 [3+] 3.84287 [4+] 2.9889 [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.