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/cp2k-7.1/src/base/machine_cpuid.h
Examining data/cp2k-7.1/src/base/machine_cpuid.c
Examining data/cp2k-7.1/src/motion/gopt_f77_methods.h
Examining data/cp2k-7.1/src/sockets.c
Examining data/cp2k-7.1/src/semi_empirical_int_args.h
Examining data/cp2k-7.1/src/start/libcp2k.h
Examining data/cp2k-7.1/src/start/libcp2k_unittest.c
Examining data/cp2k-7.1/src/semi_empirical_int_debug.h
Examining data/cp2k-7.1/src/pw/cuda/pw_cuda_utils.h
Examining data/cp2k-7.1/src/pw/cuda/fft_cuda.h
Examining data/cp2k-7.1/src/pw/cuda/pw_cuda.h
Examining data/cp2k-7.1/src/pw/cuda/fft_cuda_internal.h
Examining data/cp2k-7.1/src/pw/cuda/fft_cuda_utils.h
Examining data/cp2k-7.1/src/pw/fpga/opencl_utils.c
Examining data/cp2k-7.1/src/pw/fpga/opencl_utils.h
Examining data/cp2k-7.1/src/pw/fpga/fft_fpga.c
Examining data/cp2k-7.1/src/pw/fpga/fft_fpga.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/cuda/acc_cuda_error.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/parameters_utils.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/libcusmm.cpp
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_dnt_largeDB1.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_transpose.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_dnt_tiny.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_dnt_medium.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_dnt_largeDB2.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_dnt_small.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/kernels/cusmm_common.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/libcusmm_benchmark.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/libcusmm/libcusmm.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/libsmm_acc/include/libsmm_acc.h
Examining data/cp2k-7.1/exts/dbcsr/src/acc/include/acc.h
Examining data/cp2k-7.1/exts/dbcsr/src/dbcsr.h
Examining data/cp2k-7.1/exts/dbcsr/examples/dbcsr_example_3.cpp

FINAL RESULTS:

data/cp2k-7.1/src/pw/fpga/opencl_utils.c:127:7:  [4] (race) access:
  This usually indicates a security flaw. If an attacker can change anything
  along the path between the call to access() and the file's actual use
  (e.g., by moving files), the attacker can exploit the race condition
  (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid())
  and try to open the file directly.
  if( access( filename, R_OK ) != -1 ) {
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:359:5:  [4] (format) vprintf:
  If format strings can be influenced by an attacker, they can be exploited
  (CWE-134). Use a constant for the format specification.
    vprintf(msg, vl);
data/cp2k-7.1/src/sockets.c:101: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(serv_addr.sun_path+9, host);
data/cp2k-7.1/src/pw/fpga/fft_fpga.c:48:30:  [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.
int pw_fpga_check_bitstream_(char *data_path, int N[3]){
data/cp2k-7.1/src/pw/fpga/fft_fpga.c:162: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(h_inData, c_in, sizeof(cmplx) * N[0] * N[1] * N[2]);
data/cp2k-7.1/src/pw/fpga/fft_fpga.c:214: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(c_in, h_outData, sizeof(cmplx) * N[0] * N[1] * N[2] );
data/cp2k-7.1/src/pw/fpga/fft_fpga.h:42:30:  [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.
int pw_fpga_check_bitstream_(char *data_path, int N[3]);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:27:26:  [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.
static int getFolderPath(char **path, int N[3]);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:62: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_search[pl_len + 1];
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:76: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 pl_name[sz];
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:77: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 plat_name[sz];
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:144: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 bin_path[len_bin_path];
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:146: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 *binaries[num_device];
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:200:19:  [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.
int getFolderPath(char **folderPath, int N[3]){
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:227:8:  [2] (misc) fopen:
  Check when opening files - can an attacker redirect it (via symlinks),
  force the opening of special file type (e.g., device files), move things
  around to create a race condition, control its ancestors, or change its
  contents? (CWE-362).
  fp = fopen(binary_path, "rb");
data/cp2k-7.1/src/sockets.c:74:7:  [2] (buffer) char:
  Statically-sized arrays can be improperly restricted, leading to potential
  overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use
  functions that limit length, or ensure that the size is larger than the
  maximum possible length.
      char service[256];
data/cp2k-7.1/src/sockets.c:81: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(service,"%d",*port); // convert the port number to a string
data/cp2k-7.1/src/sockets.c:100:7:  [2] (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). Risk is low because the source is a constant string.
      strcpy(serv_addr.sun_path, "/tmp/ipi_");
data/cp2k-7.1/src/start/libcp2k_unittest.c:22: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 version_str[100];
data/cp2k-7.1/src/start/libcp2k_unittest.c:29:15:  [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* f = fopen(inp_fn, "w");
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:61:19:  [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).
  size_t pl_len = strlen(platform_name);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:203:26:  [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).
    *folderPath = malloc(strlen(folder)+1);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:204:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:204:34:  [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).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:208:26:  [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).
    *folderPath = malloc(strlen(folder)+1);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:209:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:209:34:  [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).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:213:26:  [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).
    *folderPath = malloc(strlen(folder)+1);
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:214:5:  [1] (buffer) strncpy:
  Easily used incorrectly; doesn't always \0-terminate or check for invalid
  pointers [MS-banned] (CWE-120).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:214:34:  [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).
    strncpy(*folderPath, folder, strlen(folder));
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:377: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).
  for(i=0; i<strlen(p);i++){
data/cp2k-7.1/src/pw/fpga/opencl_utils.c:381:5:  [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).
  q[strlen(p)] = '\0';
data/cp2k-7.1/src/sockets.c:147:13:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
   n = nr = read(sockfd,data,len);
data/cp2k-7.1/src/sockets.c:150:10:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
   {  nr=read(sockfd,&data[n],len-n); n+=nr; }

ANALYSIS SUMMARY:

Hits = 34
Lines analyzed = 4321 in approximately 1.37 seconds (3160 lines/second)
Physical Source Lines of Code (SLOC) = 2523
Hits@level = [0]  98 [1]  14 [2]  17 [3]   0 [4]   3 [5]   0
Hits@level+ = [0+] 132 [1+]  34 [2+]  20 [3+]   3 [4+]   3 [5+]   0
Hits/KSLOC@level+ = [0+] 52.3187 [1+] 13.476 [2+] 7.92707 [3+] 1.18906 [4+] 1.18906 [5+]   0
Dot directories skipped = 6 (--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.