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/gnat-gps-19.2/gnatcoll_extras/src/python_support_gtk.c
Examining data/gnat-gps-19.2/share/templates/simple_c_project/src/@_main_name_@.c
Examining data/gnat-gps-19.2/distrib/windows_gps_wrapper.c
Examining data/gnat-gps-19.2/widgets/src/gtksupport.c
Examining data/gnat-gps-19.2/widgets/src/check_button.c
Examining data/gnat-gps-19.2/widgets/src/gtkada_terminal.c
Examining data/gnat-gps-19.2/widgets/src/native_file_selection.c
Examining data/gnat-gps-19.2/common/core/src/os-utils.c
Examining data/gnat-gps-19.2/examples/demo/matrix_handling/matrix.c
Examining data/gnat-gps-19.2/examples/demo/matrix_handling/matrix.h
Examining data/gnat-gps-19.2/examples/demo/matrix_handling/matrix_utils.c
Examining data/gnat-gps-19.2/prj_editor/src/env.c

FINAL RESULTS:

data/gnat-gps-19.2/common/core/src/os-utils.c:75:2:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	chmod (file, statbuf.st_mode | S_IWRITE);
data/gnat-gps-19.2/common/core/src/os-utils.c:77:2:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	chmod (file, statbuf.st_mode & (~S_IWRITE));
data/gnat-gps-19.2/common/core/src/os-utils.c:89:2:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	chmod (file, statbuf.st_mode | S_IREAD);
data/gnat-gps-19.2/common/core/src/os-utils.c:91:2:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
	chmod (file, statbuf.st_mode & (~S_IREAD));
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:131:11:  [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(effective_command, dir);
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:133:11:  [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(effective_command, fname);
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:134:11:  [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(effective_command, ext);
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:209:13:  [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 (CommandLine, ca);
data/gnat-gps-19.2/examples/demo/matrix_handling/matrix_utils.c:24:15:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
              sprintf (result, "%s%d   ", result,
data/gnat-gps-19.2/examples/demo/matrix_handling/matrix_utils.c:28:11:  [4] (buffer) sprintf:
  Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or
  vsnprintf.
          sprintf(result, "%s\n", result);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:195:5:  [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 (l_Result, defaultname);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:244: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 (res, l_Result);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:345: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 (res, path);
data/gnat-gps-19.2/common/core/src/os-utils.c:112:26:  [3] (misc) LoadLibrary:
  Ensure that the full path to the library is specified, or current directory
  may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to
  find library path, if you aren't already.
          kernel32_dll = LoadLibrary ("kernel32.dll");
data/gnat-gps-19.2/common/core/src/os-utils.c:149:12:  [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.
  result = getenv ("LOGNAME");
data/gnat-gps-19.2/common/core/src/os-utils.c:154:12:  [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.
  result = getenv ("USERNAME");  /* mostly windows users */
data/gnat-gps-19.2/common/core/src/os-utils.c:159:12:  [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.
  result = getenv ("USER");
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:242:14:  [3] (shell) CreateProcess:
  This causes a new process to execute and is difficult to use safely
  (CWE-78). Specify the application path in the first argument, NOT as part
  of the second, or embedded spaces could allow an attacker to force a
  different program to run.
    result = CreateProcess
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:242:14:  [3] (shell) CreateProcess:
  This causes a new process to execute and is difficult to use safely
  (CWE-78). Specify the application path in the first argument, NOT as part
  of the second, or embedded spaces could allow an attacker to force a
  different program to run.
    result = CreateProcess
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:104: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                CommandLine[4096] = "";
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:108: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                effective_command[MAX_PATH];
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:126:11:  [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 dir[_MAX_DIR];
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:127:11:  [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 fname[_MAX_FNAME];
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:128:11:  [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 ext[_MAX_EXT];
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:132:11:  [2] (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). Risk is low because the
  source is a constant string.
          strcat(effective_command, "..\\libexec\\gps\\bin\\");
data/gnat-gps-19.2/widgets/src/native_file_selection.c:92: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         l_Filter [512];
data/gnat-gps-19.2/widgets/src/native_file_selection.c:93: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         l_Result [MAX_PATH];
data/gnat-gps-19.2/widgets/src/native_file_selection.c:102:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, basedir, -1, wbasedir, MAX_PATH);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:103:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, title, -1, wtitle, MAX_PATH);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:199:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, l_Result, -1, wl_Result, MAX_PATH);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:200:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, l_Filter, l_index, wl_Filter, MAX_PATH);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:307: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 path [MAX_PATH];
data/gnat-gps-19.2/widgets/src/native_file_selection.c:310:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, basedir, -1, wbasedir, MAX_PATH);
data/gnat-gps-19.2/widgets/src/native_file_selection.c:311:3:  [2] (buffer) MultiByteToWideChar:
  Requires maximum length in CHARACTERS, not bytes (CWE-120).
  MultiByteToWideChar (CP_UTF8, 0, title, -1, wtitle, MAX_PATH);
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:139: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).
        if (strlen(ca) > 0)
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:142: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).
        for (ca_index = 0; ca_index < strlen(ca); ca_index++)
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:156: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).
            int cl_index = strlen(CommandLine);
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:161:43:  [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 (ca_index = 0; ca_index < strlen(ca); ca_index++)
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:189:65:  [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 (ca[ca_index] == '\\' && ca_index + 1 == strlen(ca))
data/gnat-gps-19.2/distrib/windows_gps_wrapper.c:210:13:  [1] (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). Risk is low because the
  source is a constant character.
            strcat (CommandLine, " ");
data/gnat-gps-19.2/widgets/src/native_file_selection.c:243: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).
  res = malloc (sizeof (char) * (strlen (l_Result) + 1));
data/gnat-gps-19.2/widgets/src/native_file_selection.c:344: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).
  res = malloc (sizeof (char) * (strlen (path) + 1));

ANALYSIS SUMMARY:

Hits = 42
Lines analyzed = 1409 in approximately 0.42 seconds (3384 lines/second)
Physical Source Lines of Code (SLOC) = 917
Hits@level = [0]   1 [1]   8 [2]  15 [3]   6 [4]   9 [5]   4
Hits@level+ = [0+]  43 [1+]  42 [2+]  34 [3+]  19 [4+]  13 [5+]   4
Hits/KSLOC@level+ = [0+] 46.892 [1+] 45.8015 [2+] 37.0774 [3+] 20.7197 [4+] 14.1767 [5+] 4.36205
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.