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/r-cran-tgp-2.4-17/src/mr_exp_sep.cc
Examining data/r-cran-tgp-2.4-17/src/mstructs.cc
Examining data/r-cran-tgp-2.4-17/src/rhelp.h
Examining data/r-cran-tgp-2.4-17/src/temper.cc
Examining data/r-cran-tgp-2.4-17/src/matrix.h
Examining data/r-cran-tgp-2.4-17/src/gp.cc
Examining data/r-cran-tgp-2.4-17/src/rand_pdf.h
Examining data/r-cran-tgp-2.4-17/src/lik_post.h
Examining data/r-cran-tgp-2.4-17/src/tgp.h
Examining data/r-cran-tgp-2.4-17/src/rand_draws.h
Examining data/r-cran-tgp-2.4-17/src/gp.h
Examining data/r-cran-tgp-2.4-17/src/sim.h
Examining data/r-cran-tgp-2.4-17/src/corr.h
Examining data/r-cran-tgp-2.4-17/src/dopt.c
Examining data/r-cran-tgp-2.4-17/src/tree.h
Examining data/r-cran-tgp-2.4-17/src/exp.h
Examining data/r-cran-tgp-2.4-17/src/init.c
Examining data/r-cran-tgp-2.4-17/src/twovar.cc
Examining data/r-cran-tgp-2.4-17/src/exp_sep.cc
Examining data/r-cran-tgp-2.4-17/src/params.h
Examining data/r-cran-tgp-2.4-17/src/temper.h
Examining data/r-cran-tgp-2.4-17/src/params.cc
Examining data/r-cran-tgp-2.4-17/src/rand_draws.c
Examining data/r-cran-tgp-2.4-17/src/lh.c
Examining data/r-cran-tgp-2.4-17/src/linalg.h
Examining data/r-cran-tgp-2.4-17/src/gen_covar.h
Examining data/r-cran-tgp-2.4-17/src/model.h
Examining data/r-cran-tgp-2.4-17/src/matern.h
Examining data/r-cran-tgp-2.4-17/src/predict_linear.c
Examining data/r-cran-tgp-2.4-17/src/predict.h
Examining data/r-cran-tgp-2.4-17/src/mstructs.h
Examining data/r-cran-tgp-2.4-17/src/base.cc
Examining data/r-cran-tgp-2.4-17/src/predict.c
Examining data/r-cran-tgp-2.4-17/src/all_draws.c
Examining data/r-cran-tgp-2.4-17/src/list.cc
Examining data/r-cran-tgp-2.4-17/src/mr_exp_sep.h
Examining data/r-cran-tgp-2.4-17/src/tree.cc
Examining data/r-cran-tgp-2.4-17/src/matrix.c
Examining data/r-cran-tgp-2.4-17/src/twovar.h
Examining data/r-cran-tgp-2.4-17/src/rhelp.c
Examining data/r-cran-tgp-2.4-17/src/all_draws.h
Examining data/r-cran-tgp-2.4-17/src/exp_sep.h
Examining data/r-cran-tgp-2.4-17/src/gen_covar.c
Examining data/r-cran-tgp-2.4-17/src/model.cc
Examining data/r-cran-tgp-2.4-17/src/predict_linear.h
Examining data/r-cran-tgp-2.4-17/src/lik_post.c
Examining data/r-cran-tgp-2.4-17/src/dopt.h
Examining data/r-cran-tgp-2.4-17/src/corr.cc
Examining data/r-cran-tgp-2.4-17/src/tgp.cc
Examining data/r-cran-tgp-2.4-17/src/randomkit.c
Examining data/r-cran-tgp-2.4-17/src/base.h
Examining data/r-cran-tgp-2.4-17/src/sim.cc
Examining data/r-cran-tgp-2.4-17/src/randomkit.h
Examining data/r-cran-tgp-2.4-17/src/linalg.c
Examining data/r-cran-tgp-2.4-17/src/lh.h
Examining data/r-cran-tgp-2.4-17/src/list.h
Examining data/r-cran-tgp-2.4-17/src/rand_pdf.c
Examining data/r-cran-tgp-2.4-17/src/exp.cc
Examining data/r-cran-tgp-2.4-17/src/matern.cc

FINAL RESULTS:

data/r-cran-tgp-2.4-17/src/corr.cc:557: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_copy, line);
data/r-cran-tgp-2.4-17/src/exp.cc:700: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_copy, line);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:1014: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_copy, line);
data/r-cran-tgp-2.4-17/src/gp.cc:1382: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_copy, line);
data/r-cran-tgp-2.4-17/src/gp.cc:1396: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_copy, line);
data/r-cran-tgp-2.4-17/src/matern.cc:755: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_copy, line);
data/r-cran-tgp-2.4-17/src/model.cc:1370:3:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
  sprintf(outfile_str, "%s_%s_%d.out", prefix, type, Id+1);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1331: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_copy, line);
data/r-cran-tgp-2.4-17/src/rhelp.c:51:8:  [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.
  else vfprintf(outfile, str, argp);
data/r-cran-tgp-2.4-17/src/rhelp.c:53: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(outfile, str, argp);
data/r-cran-tgp-2.4-17/src/rhelp.c:73: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(stderr, str, argp);
data/r-cran-tgp-2.4-17/src/rhelp.c:98: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(stderr, str, argp);
data/r-cran-tgp-2.4-17/src/sim.cc:848: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_copy, line);
data/r-cran-tgp-2.4-17/src/twovar.cc:723: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_copy, line);
data/r-cran-tgp-2.4-17/src/rand_draws.c:40:8:  [3] (random) erand48:
  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.
double erand48(unsigned short xseed[3]); 
data/r-cran-tgp-2.4-17/src/rand_draws.c:203:12:  [3] (random) erand48:
  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.
    return erand48(state);
data/r-cran-tgp-2.4-17/src/rand_draws.c:355:12:  [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.
    double random, uniform;
data/r-cran-tgp-2.4-17/src/rand_draws.c:358:12:  [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.
    return random;
data/r-cran-tgp-2.4-17/src/rand_draws.c:372:10:  [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.
  double random, x;
data/r-cran-tgp-2.4-17/src/rand_draws.c:383:27:  [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.
      if ( uniform1 > pow(random,alpha - 1))
data/r-cran-tgp-2.4-17/src/rand_draws.c:386:9:  [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.
	return random;
data/r-cran-tgp-2.4-17/src/rand_draws.c:392:28:  [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.
      if ( uniform1 > exp(-random))
data/r-cran-tgp-2.4-17/src/rand_draws.c:395:9:  [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.
	return random;
data/r-cran-tgp-2.4-17/src/rand_draws.c:412:10:  [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.
  double random;
data/r-cran-tgp-2.4-17/src/rand_draws.c:445:10:  [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.
  return random;
data/r-cran-tgp-2.4-17/src/rand_draws.c:467:14:  [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.
    } while (random < 0 );
data/r-cran-tgp-2.4-17/src/rand_draws.c:473:14:  [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.
    } while (random < 0);
data/r-cran-tgp-2.4-17/src/rand_draws.c:474:10:  [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.
  return random;
data/r-cran-tgp-2.4-17/src/corr.cc:544: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp.cc:407: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp.cc:414:14:  [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(linear) sprintf(buffer, "0(%g)", d);
data/r-cran-tgp-2.4-17/src/exp.cc:415:8:  [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.
  else sprintf(buffer, "%g", d);
data/r-cran-tgp-2.4-17/src/exp.cc:418: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(buffer, ", g=%g)", nug);
data/r-cran-tgp-2.4-17/src/exp.cc:683: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp_sep.cc:642: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp_sep.cc:648: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(buffer, "%d=[", which);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:658:14:  [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(linear) sprintf(buffer, "0]");
data/r-cran-tgp-2.4-17/src/exp_sep.cc:664: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(b[i] == 0.0) sprintf(buffer, "%g/%g ", d_eff[i], d[i]);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:665:12:  [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.
      else sprintf(buffer, "%g ", d[i]);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:670:25:  [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(b[dim-1] == 0.0) sprintf(buffer, "%g/%g]", d_eff[dim-1], d[dim-1]);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:671:10:  [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.
    else sprintf(buffer, "%g]", d[dim-1]);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:677: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(buffer, ", g=%g)", nug);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:816: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(trace[1+i], "d%d", i+1);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:822: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(trace[1+dim+i], "b%d", i+1);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:990: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp_sep.cc:1330: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(trace[j], "d%d.a0", i);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:1332: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(trace[j+1], "d%d.g0", i);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:1334: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(trace[j+2], "d%d.a1", i);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:1336: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(trace[j+3], "d%d.g1", i);
data/r-cran-tgp-2.4-17/src/gp.cc:917: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(trace[3+i], "beta%d", i);
data/r-cran-tgp-2.4-17/src/gp.cc:926:7:  [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(trace[3+col+i], "bmu%d", i);
data/r-cran-tgp-2.4-17/src/gp.cc:933: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(trace[3+2*col+ col*i +j], "Vb%d.%d", i, j);
data/r-cran-tgp-2.4-17/src/gp.cc:1314: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/gp.cc:2051: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(trace[4+i], "beta%d", i);
data/r-cran-tgp-2.4-17/src/gp.cc:2059: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(trace[4+col+ col*i +j], "Ti%d.%d", i, j);
data/r-cran-tgp-2.4-17/src/matern.cc:443: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/matern.cc:449:14:  [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(linear) sprintf(buffer, "0(%g)", d);
data/r-cran-tgp-2.4-17/src/matern.cc:450:8:  [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.
  else sprintf(buffer, "%g", d);
data/r-cran-tgp-2.4-17/src/matern.cc:453: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(buffer, ", g=%g)", nug);
data/r-cran-tgp-2.4-17/src/matern.cc:738: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/matrix.c:1472: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).
  MmOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/matrix.c:1490:10:  [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).
  VOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/matrix.c:1506:10:  [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).
  MOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/matrix.c:1522:10:  [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).
  MOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/matrix.c:1539:10:  [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).
  MOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/matrix.c:2404:10:  [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).
  VOUT = fopen(file_str, "w");
data/r-cran-tgp-2.4-17/src/model.cc:1369: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 outfile_str[BUFFMAX];
data/r-cran-tgp-2.4-17/src/model.cc:1371: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).
  FILE* OFILE = fopen(outfile_str, "w");
data/r-cran-tgp-2.4-17/src/model.cc:1515: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 filestr[MEDBUFF];
data/r-cran-tgp-2.4-17/src/model.cc:1518: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(filestr, "tree_m%d_posts.out", Id);
data/r-cran-tgp-2.4-17/src/model.cc:1519: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).
  FILE *postsfile = fopen(filestr, "w");
data/r-cran-tgp-2.4-17/src/model.cc:1531: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(filestr, "tree_m%d_%d.out", Id, i+1);
data/r-cran-tgp-2.4-17/src/model.cc:1532:22:  [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 *treefile = fopen(filestr, "w");
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:900: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:907:14:  [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(linear) sprintf(buffer, "0]");
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:913: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(b[i] == 0.0) sprintf(buffer, "%g/%g ", d_eff[i], d[i]);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:914:12:  [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.
      else sprintf(buffer, "%g ", d[i]);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:919:27:  [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(b[dim*2-1] == 0.0) sprintf(buffer, "%g/%g],", d_eff[dim*2-1], d[dim*2-1]);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:920:10:  [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.
    else sprintf(buffer, "%g],", d[dim*2-1]);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:925: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(buffer, " g=[%g", nug);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:927: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(buffer, " %g]", nugaux);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:931: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(buffer, ", delta=%g)", delta);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1062: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(trace[3+i], "d%d", i+1);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1068: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(trace[3+2*dim+i], "b%d", i+1);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1295: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1794: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(trace[j], "d%d.a0", i);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1796: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(trace[j+1], "d%d.g0", i);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1798: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(trace[j+2], "d%d.a1", i);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:1800: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(trace[j+3], "d%d.g1", i);
data/r-cran-tgp-2.4-17/src/params.cc: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 line[BUFFMAX];
data/r-cran-tgp-2.4-17/src/params.cc:154:15:  [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).
  t_minpart = atoi(strtok(NULL, " \t\n#"));
data/r-cran-tgp-2.4-17/src/params.cc:158:16:  [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).
  t_splitmin = atoi(strtok(NULL, " \t\n#")) - 1;
data/r-cran-tgp-2.4-17/src/params.cc:160:15:  [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).
  t_basemax = atoi(strtok(NULL, " \t\n#"));
data/r-cran-tgp-2.4-17/src/randomkit.c:76: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 *rk_strerror[RK_ERR_MAX] =
data/r-cran-tgp-2.4-17/src/randomkit.c:256: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).
		rfile = fopen(RK_DEV_RANDOM, "rb");
data/r-cran-tgp-2.4-17/src/randomkit.c:258: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).
		rfile = fopen(RK_DEV_URANDOM, "rb");
data/r-cran-tgp-2.4-17/src/randomkit.h:82: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 *rk_strerror[RK_ERR_MAX];
data/r-cran-tgp-2.4-17/src/sim.cc:490: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/sim.cc:496: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(buffer, "%d=[", which);
data/r-cran-tgp-2.4-17/src/sim.cc:505: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(buffer, "%g ", d[i]);
data/r-cran-tgp-2.4-17/src/sim.cc:510: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(buffer, "%g]", d[dim-1]);
data/r-cran-tgp-2.4-17/src/sim.cc:516: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(buffer, ", g=%g)", nug);
data/r-cran-tgp-2.4-17/src/sim.cc:606: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(trace[1+i], "d%d", i+1);
data/r-cran-tgp-2.4-17/src/sim.cc:824: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/sim.cc:1177: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(trace[j], "d%d.a0", i);
data/r-cran-tgp-2.4-17/src/sim.cc:1179: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(trace[j+1], "d%d.g0", i);
data/r-cran-tgp-2.4-17/src/sim.cc:1181: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(trace[j+2], "d%d.a1", i);
data/r-cran-tgp-2.4-17/src/sim.cc:1183: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(trace[j+3], "d%d.g1", i);
data/r-cran-tgp-2.4-17/src/temper.cc:894: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 *LOUT = fopen(file_str, "a");
data/r-cran-tgp-2.4-17/src/twovar.cc:443: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[BUFFMAX];
data/r-cran-tgp-2.4-17/src/twovar.cc:450:14:  [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(linear) sprintf(buffer, "0(%g)", d);
data/r-cran-tgp-2.4-17/src/twovar.cc:451:8:  [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.
  else sprintf(buffer, "%g", d);
data/r-cran-tgp-2.4-17/src/twovar.cc:454: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(buffer, ", g=%g)", nug);
data/r-cran-tgp-2.4-17/src/twovar.cc:706: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[BUFFMAX], line_copy[BUFFMAX];
data/r-cran-tgp-2.4-17/src/exp.cc:423:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());
data/r-cran-tgp-2.4-17/src/exp_sep.cc:433:15:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
      equal = equal && (d_new_eff[i] == d_eff[i]);
data/r-cran-tgp-2.4-17/src/exp_sep.cc:437:8:  [1] (buffer) equal:
  Function does not check the second iterator for over-read conditions
  (CWE-126). This function is often discouraged by most C++ coding standards
  in favor of its safer alternatives provided since C++14. Consider using a
  form of this function that checks the second iterator before potentially
  overflowing it.
    if(equal) { free(d_new_eff); d_new_eff = NULL; }
data/r-cran-tgp-2.4-17/src/exp_sep.cc:683:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());
data/r-cran-tgp-2.4-17/src/matern.cc:458:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());
data/r-cran-tgp-2.4-17/src/model.cc:1183:5:  [1] (obsolete) usleep:
  This C routine is considered obsolete (as opposed to the shell command by
  the same name). The interaction of this function with SIGALRM and other
  timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is
  unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead.
    usleep(500000);
data/r-cran-tgp-2.4-17/src/mr_exp_sep.cc:936:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());
data/r-cran-tgp-2.4-17/src/sim.cc:522:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());
data/r-cran-tgp-2.4-17/src/twovar.cc:459:3:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
  strncpy(ret_str, s.c_str(), s.length());

ANALYSIS SUMMARY:

Hits = 123
Lines analyzed = 30733 in approximately 0.76 seconds (40564 lines/second)
Physical Source Lines of Code (SLOC) = 15429
Hits@level = [0]   1 [1]   9 [2]  86 [3]  14 [4]  14 [5]   0
Hits@level+ = [0+] 124 [1+] 123 [2+] 114 [3+]  28 [4+]  14 [5+]   0
Hits/KSLOC@level+ = [0+] 8.03681 [1+] 7.972 [2+] 7.38868 [3+] 1.81476 [4+] 0.907382 [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.