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/gpaw-20.10.0/c/_gpaw.c
Examining data/gpaw-20.10.0/c/bc.c
Examining data/gpaw-20.10.0/c/bc.h
Examining data/gpaw-20.10.0/c/blacs.c
Examining data/gpaw-20.10.0/c/blas.c
Examining data/gpaw-20.10.0/c/bmgs/bmgs.c
Examining data/gpaw-20.10.0/c/bmgs/bmgs.h
Examining data/gpaw-20.10.0/c/bmgs/cut.c
Examining data/gpaw-20.10.0/c/bmgs/fd.c
Examining data/gpaw-20.10.0/c/bmgs/interpolate.c
Examining data/gpaw-20.10.0/c/bmgs/paste.c
Examining data/gpaw-20.10.0/c/bmgs/relax.c
Examining data/gpaw-20.10.0/c/bmgs/restrict.c
Examining data/gpaw-20.10.0/c/bmgs/spherical_harmonics.h
Examining data/gpaw-20.10.0/c/bmgs/spline.c
Examining data/gpaw-20.10.0/c/bmgs/stencils.c
Examining data/gpaw-20.10.0/c/bmgs/translate.c
Examining data/gpaw-20.10.0/c/bmgs/wfd.c
Examining data/gpaw-20.10.0/c/bmgs/wrelax.c
Examining data/gpaw-20.10.0/c/bmgs/zero.c
Examining data/gpaw-20.10.0/c/constraints.c
Examining data/gpaw-20.10.0/c/elpa.c
Examining data/gpaw-20.10.0/c/extensions.h
Examining data/gpaw-20.10.0/c/f2c.h
Examining data/gpaw-20.10.0/c/fftw.c
Examining data/gpaw-20.10.0/c/lcao.c
Examining data/gpaw-20.10.0/c/lfc.c
Examining data/gpaw-20.10.0/c/lfc.h
Examining data/gpaw-20.10.0/c/lfc2.c
Examining data/gpaw-20.10.0/c/mpi.c
Examining data/gpaw-20.10.0/c/mympi.h
Examining data/gpaw-20.10.0/c/operators.c
Examining data/gpaw-20.10.0/c/plane_wave.c
Examining data/gpaw-20.10.0/c/plt.c
Examining data/gpaw-20.10.0/c/point_charges.c
Examining data/gpaw-20.10.0/c/spline.c
Examining data/gpaw-20.10.0/c/spline.h
Examining data/gpaw-20.10.0/c/symmetry.c
Examining data/gpaw-20.10.0/c/tetra.c
Examining data/gpaw-20.10.0/c/transformers.c
Examining data/gpaw-20.10.0/c/utilities.c
Examining data/gpaw-20.10.0/c/wigner_seitz.c
Examining data/gpaw-20.10.0/c/woperators.c
Examining data/gpaw-20.10.0/c/xc/ensemble_gga.c
Examining data/gpaw-20.10.0/c/xc/libvdwxc.c
Examining data/gpaw-20.10.0/c/xc/libxc.c
Examining data/gpaw-20.10.0/c/xc/m06l.c
Examining data/gpaw-20.10.0/c/xc/pbe.c
Examining data/gpaw-20.10.0/c/xc/pw91.c
Examining data/gpaw-20.10.0/c/xc/revtpss.c
Examining data/gpaw-20.10.0/c/xc/revtpss_c_pbe.c
Examining data/gpaw-20.10.0/c/xc/rpbe.c
Examining data/gpaw-20.10.0/c/xc/tpss.c
Examining data/gpaw-20.10.0/c/xc/vdw.c
Examining data/gpaw-20.10.0/c/xc/xc.c
Examining data/gpaw-20.10.0/c/xc/xc_gpaw.h
Examining data/gpaw-20.10.0/c/xc/xc_mgga.c
Examining data/gpaw-20.10.0/c/xc/xc_mgga.h
Examining data/gpaw-20.10.0/doc/platforms/Cray/dynload_redstorm.c

FINAL RESULTS:

data/gpaw-20.10.0/c/bmgs/fd.c:64:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/bmgs/fd.c:65:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/interpolate.c:74:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/bmgs/interpolate.c:75:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/restrict.c:71:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/bmgs/restrict.c:72:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/wfd.c:82:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/bmgs/wfd.c:83:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/operators.c:347:7:  [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 (getenv("GPAW_CHUNK_SIZE") != NULL)
data/gpaw-20.10.0/c/operators.c:348:22:  [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.
    chunksize = atoi(getenv("GPAW_CHUNK_SIZE"));
data/gpaw-20.10.0/c/operators.c:351:7:  [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 (getenv("GPAW_CHUNK_INC") != NULL)
data/gpaw-20.10.0/c/operators.c:352:21:  [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.
    chunkinc = atoi(getenv("GPAW_CHUNK_INC"));
data/gpaw-20.10.0/c/operators.c:356:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/operators.c:357:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/transformers.c:152:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/transformers.c:153:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/woperators.c:393:7:  [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 (getenv("GPAW_CHUNK_SIZE") != NULL)
data/gpaw-20.10.0/c/woperators.c:394:22:  [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.
    chunksize = atoi(getenv("GPAW_CHUNK_SIZE"));
data/gpaw-20.10.0/c/woperators.c:397:7:  [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 (getenv("GPAW_CHUNK_INC") != NULL)
data/gpaw-20.10.0/c/woperators.c:398:21:  [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.
    chunkinc = atoi(getenv("GPAW_CHUNK_INC"));
data/gpaw-20.10.0/c/woperators.c:402:7:  [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 (getenv("OMP_NUM_THREADS") != NULL)
data/gpaw-20.10.0/c/woperators.c:403:18:  [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.
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/_gpaw.c:316: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(dst, src, size);
data/gpaw-20.10.0/c/_gpaw.c:460:16:  [2] (buffer) wchar_t:
  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.
#define PyChar wchar_t
data/gpaw-20.10.0/c/bmgs/cut.c:15:11:  [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(b, a, m[2] * sizeof(T));
data/gpaw-20.10.0/c/bmgs/fd.c:65:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/interpolate.c:75:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/paste.c:14: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(b, a, sizea[2] * sizeof(T));
data/gpaw-20.10.0/c/bmgs/restrict.c:72:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/bmgs/stencils.c:24: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(stencil.coefs, coefs, ncoefs * sizeof(double));
data/gpaw-20.10.0/c/bmgs/stencils.c:25: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(stencil.offsets, offsets, ncoefs * sizeof(long));
data/gpaw-20.10.0/c/bmgs/translate.c:18:11:  [2] (buffer) memcpy:
  Does not check for buffer overflows when copying to destination (CWE-120).
  Make sure destination can always hold the source data.
          memcpy(d, s, size[2] * sizeof(double));
data/gpaw-20.10.0/c/bmgs/wfd.c:83:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/lfc.c:877: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(PyArray_DATA(A_gm_obj), A_gm, ngm * sizeof(double));
data/gpaw-20.10.0/c/lfc.c:883: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(PyArray_DATA(G_B_obj), G_B, nB * sizeof(int));
data/gpaw-20.10.0/c/mpi.c:241:13:  [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[MPI_MAX_ERROR_STRING];
data/gpaw-20.10.0/c/mpi.c:425: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 name[MPI_MAX_PROCESSOR_NAME];
data/gpaw-20.10.0/c/mpi.c:736:11:  [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(PyArray_BYTES(aobj), b, n * elemsize);
data/gpaw-20.10.0/c/mpi.c:755:15:  [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(PyArray_BYTES(aobj), b, n * elemsize);
data/gpaw-20.10.0/c/mpi.c:1018: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(INTP(ranks), self->members, self->size*sizeof(int));
data/gpaw-20.10.0/c/mpi.c:1268: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(obj->members, (int *) PyArray_BYTES(iranks), obj->size*sizeof(int));
data/gpaw-20.10.0/c/operators.c:348:17:  [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).
    chunksize = atoi(getenv("GPAW_CHUNK_SIZE"));
data/gpaw-20.10.0/c/operators.c:352: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).
    chunkinc = atoi(getenv("GPAW_CHUNK_INC"));
data/gpaw-20.10.0/c/operators.c:357:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/plt.c:70: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).
  Output_p = fopen(fname,"wb");
data/gpaw-20.10.0/c/transformers.c:153:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/utilities.c:191: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).
    fp = fopen("gpaw_perf.log", "w");
data/gpaw-20.10.0/c/utilities.c:261: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).
    fp = fopen("gpaw_perf.log", "w");
data/gpaw-20.10.0/c/woperators.c:394:17:  [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).
    chunksize = atoi(getenv("GPAW_CHUNK_SIZE"));
data/gpaw-20.10.0/c/woperators.c:398: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).
    chunkinc = atoi(getenv("GPAW_CHUNK_INC"));
data/gpaw-20.10.0/c/woperators.c:403:13:  [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).
    nthds = atoi(getenv("OMP_NUM_THREADS"));
data/gpaw-20.10.0/c/xc/libvdwxc.c:143:5:  [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[maxlen];
data/gpaw-20.10.0/c/xc/libxc.c:279: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(ptr,block,blocksize*sizeof(double));

ANALYSIS SUMMARY:

Hits = 53
Lines analyzed = 17210 in approximately 1.03 seconds (16740 lines/second)
Physical Source Lines of Code (SLOC) = 14153
Hits@level = [0]  27 [1]   0 [2]  31 [3]  22 [4]   0 [5]   0
Hits@level+ = [0+]  80 [1+]  53 [2+]  53 [3+]  22 [4+]   0 [5+]   0
Hits/KSLOC@level+ = [0+] 5.65251 [1+] 3.74479 [2+] 3.74479 [3+] 1.55444 [4+]   0 [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.