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/flatpak-builder-1.0.11/libglnx/tests/libglnx-testlib.h
Examining data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c
Examining data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c
Examining data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-macros.c
Examining data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-shutil.c
Examining data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-macros.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-backport-autocleanups.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-backport-autoptr.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-backports.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-backports.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-local-alloc.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-local-alloc.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-errors.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-errors.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-console.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-console.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-dirfd.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-dirfd.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-fdio.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-lockfile.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-lockfile.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-missing-syscall.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-missing.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c
Examining data/flatpak-builder-1.0.11/libglnx/glnx-shutil.h
Examining data/flatpak-builder-1.0.11/libglnx/glnx-shutil.c
Examining data/flatpak-builder-1.0.11/libglnx/libglnx.h
Examining data/flatpak-builder-1.0.11/src/builder-main.c
Examining data/flatpak-builder-1.0.11/src/builder-manifest.c
Examining data/flatpak-builder-1.0.11/src/builder-manifest.h
Examining data/flatpak-builder-1.0.11/src/builder-options.c
Examining data/flatpak-builder-1.0.11/src/builder-options.h
Examining data/flatpak-builder-1.0.11/src/builder-extension.c
Examining data/flatpak-builder-1.0.11/src/builder-extension.h
Examining data/flatpak-builder-1.0.11/src/builder-module.c
Examining data/flatpak-builder-1.0.11/src/builder-module.h
Examining data/flatpak-builder-1.0.11/src/builder-post-process.c
Examining data/flatpak-builder-1.0.11/src/builder-post-process.h
Examining data/flatpak-builder-1.0.11/src/builder-source.c
Examining data/flatpak-builder-1.0.11/src/builder-source.h
Examining data/flatpak-builder-1.0.11/src/builder-source-archive.c
Examining data/flatpak-builder-1.0.11/src/builder-source-archive.h
Examining data/flatpak-builder-1.0.11/src/builder-source-git.c
Examining data/flatpak-builder-1.0.11/src/builder-source-git.h
Examining data/flatpak-builder-1.0.11/src/builder-source-bzr.c
Examining data/flatpak-builder-1.0.11/src/builder-source-bzr.h
Examining data/flatpak-builder-1.0.11/src/builder-source-svn.c
Examining data/flatpak-builder-1.0.11/src/builder-source-svn.h
Examining data/flatpak-builder-1.0.11/src/builder-source-file.c
Examining data/flatpak-builder-1.0.11/src/builder-source-file.h
Examining data/flatpak-builder-1.0.11/src/builder-source-script.c
Examining data/flatpak-builder-1.0.11/src/builder-source-script.h
Examining data/flatpak-builder-1.0.11/src/builder-source-shell.c
Examining data/flatpak-builder-1.0.11/src/builder-source-shell.h
Examining data/flatpak-builder-1.0.11/src/builder-source-extra-data.c
Examining data/flatpak-builder-1.0.11/src/builder-source-extra-data.h
Examining data/flatpak-builder-1.0.11/src/builder-source-patch.c
Examining data/flatpak-builder-1.0.11/src/builder-source-patch.h
Examining data/flatpak-builder-1.0.11/src/builder-source-dir.c
Examining data/flatpak-builder-1.0.11/src/builder-source-dir.h
Examining data/flatpak-builder-1.0.11/src/builder-context.c
Examining data/flatpak-builder-1.0.11/src/builder-context.h
Examining data/flatpak-builder-1.0.11/src/builder-cache.c
Examining data/flatpak-builder-1.0.11/src/builder-cache.h
Examining data/flatpak-builder-1.0.11/src/builder-utils.c
Examining data/flatpak-builder-1.0.11/src/builder-utils.h
Examining data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c
Examining data/flatpak-builder-1.0.11/src/builder-flatpak-utils.h
Examining data/flatpak-builder-1.0.11/src/builder-git.c
Examining data/flatpak-builder-1.0.11/src/builder-git.h
Examining data/flatpak-builder-1.0.11/src/builder-sdk-config.c
Examining data/flatpak-builder-1.0.11/src/builder-sdk-config.h

FINAL RESULTS:

data/flatpak-builder-1.0.11/src/builder-manifest.c:4164:11:  [4] (shell) execvp:
  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 (execvp ((char *) args->pdata[0], (char **) args->pdata) == -1)
data/flatpak-builder-1.0.11/src/builder-module.c:1242:7:  [4] (shell) execvp:
  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 (execvp ((char *) args->pdata[0], (char **) args->pdata) == -1)
data/flatpak-builder-1.0.11/libglnx/glnx-dirfd.c:275:25:  [3] (random) g_random_int_range:
  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.
    XXXXXX[i] = letters[g_random_int_range(0, NLETTERS)];
data/flatpak-builder-1.0.11/libglnx/glnx-dirfd.c:363:45:  [3] (buffer) g_get_tmp_dir:
  This function is synonymous with 'getenv("TMP")';it returns untrustable
  input if the environment can beset by an attacker. It 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.
  g_autofree char *path = g_build_filename (g_get_tmp_dir (), tmpl, NULL);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:44:32:  [3] (random) g_random_int_range:
  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.
  const guint8 randxattrbyte = g_random_int_range (0, 256);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:45:39:  [3] (random) g_random_int:
  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.
  const guint32 randxattrvalue_len = (g_random_int () % 256) + 1; /* Picked to be not too small or large */
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:62:32:  [3] (random) g_random_int:
  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.
  const guint nattrs = MIN (2, g_random_int () % 16);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:66:33:  [3] (random) g_random_int:
  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.
      guint32 randxattrname_v = g_random_int ();
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:79:21:  [3] (random) g_random_int:
  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.
  WriteType wtype = g_random_int () % 2;
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:83:28:  [3] (random) g_random_int:
  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.
      guint32 randname_v = g_random_int ();
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:228:51:  [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.
                                                  getenv ("TMPDIR") ?: "/var/tmp");
data/flatpak-builder-1.0.11/src/builder-cache.c:1371:40:  [3] (random) g_random_int:
  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.
  builder_cache_checksum_uint32 (self, g_random_int ());
data/flatpak-builder-1.0.11/src/builder-cache.c:1372:40:  [3] (random) g_random_int:
  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.
  builder_cache_checksum_uint32 (self, g_random_int ());
data/flatpak-builder-1.0.11/src/builder-module.c:1169:31:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
  source_dir_path_canonical = realpath (source_dir_path, NULL);
data/flatpak-builder-1.0.11/src/builder-source-shell.c:137:31:  [3] (buffer) realpath:
  This function does not protect against buffer overflows, and some
  implementations can overflow internally (CWE-120/CWE-785!). Ensure that the
  destination buffer is at least of size MAXPATHLEN, andto protect against
  implementation problems, the input argument should also be checked to
  ensure it is no larger than MAXPATHLEN.
  source_dir_path_canonical = realpath (source_dir_path, NULL);
data/flatpak-builder-1.0.11/libglnx/glnx-console.c:246: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.
  { const char beginbuf[2] = { 0x1B, 0x38 };
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:348: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 proc_fd_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(tmpf->fd) + 1];
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:350: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 (proc_fd_path, "/proc/self/fd/%i", tmpf->fd);
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:837:9:  [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 buf[m];
data/flatpak-builder-1.0.11/libglnx/glnx-macros.h:104:38:  [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 G_GNUC_UNUSED char _static_assert__macros_need_to_be_extended[20 - sizeof((int[]){__VA_ARGS__})/sizeof(int)]; \
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:259: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 buf[PATH_MAX];
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:316: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 buf[PATH_MAX];
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:376: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 pathbuf[PATH_MAX];
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:436: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 pathbuf[PATH_MAX];
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c:58:8:  [2] (misc) open:
  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).
  fd = open (noent_path, O_RDONLY);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c:71:8:  [2] (misc) open:
  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).
  fd = open (noent_path, O_RDONLY);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c:86:8:  [2] (misc) open:
  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).
  fd = open (noent_path, O_RDONLY);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c:103:8:  [2] (misc) open:
  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).
  fd = open (noent_path, O_RDONLY);
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-errors.c:115:8:  [2] (misc) open:
  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).
  fd = open (noent_path, O_RDONLY);
data/flatpak-builder-1.0.11/src/builder-cache.c:688: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 checksum[OSTREE_SHA256_STRING_LEN+1];
data/flatpak-builder-1.0.11/src/builder-context.c:378:37:  [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.
                              const char     *url,
data/flatpak-builder-1.0.11/src/builder-context.c:379:37:  [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.
                              const char    **mirrors,
data/flatpak-builder-1.0.11/src/builder-context.c:381:37:  [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.
                              const char     *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-context.h:66:53:  [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.
                                              const char     *url,
data/flatpak-builder-1.0.11/src/builder-context.h:67:53:  [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.
                                              const char    **mirrors,
data/flatpak-builder-1.0.11/src/builder-context.h:69:53:  [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.
                                              const char     *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:105: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 buf[32*1024];
data/flatpak-builder-1.0.11/src/builder-post-process.c:137:8:  [2] (misc) open:
  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).
  fd = open (path, O_RDONLY | O_CLOEXEC | O_NOFOLLOW);
data/flatpak-builder-1.0.11/src/builder-source-archive.c:306:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-source-archive.c:396:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-source-archive.c:804:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-source-file.c:221:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-source-file.c:347:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-source-file.c:482:9:  [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.
  const char *checksums[BUILDER_CHECKSUMS_LEN];
data/flatpak-builder-1.0.11/src/builder-utils.c:234:12:  [2] (misc) open:
  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).
      fd = open (path, O_RDONLY | O_NOFOLLOW | O_CLOEXEC);
data/flatpak-builder-1.0.11/src/builder-utils.c:922: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.
      dir_len = strlen ((char *) dirt[value]);
data/flatpak-builder-1.0.11/src/builder-utils.c:926: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 (s, file, file_len + 1);
data/flatpak-builder-1.0.11/src/builder-utils.c:930: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 (s, dirt[value], dir_len);
data/flatpak-builder-1.0.11/src/builder-utils.c:932: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 (s + dir_len + 1, file, file_len + 1);
data/flatpak-builder-1.0.11/src/builder-utils.c:939: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 (s, comp_dir, comp_dir_len);
data/flatpak-builder-1.0.11/src/builder-utils.c:943: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 (p, dirt[value], dir_len);
data/flatpak-builder-1.0.11/src/builder-utils.c:945: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 (p + dir_len + 1, file, file_len + 1);
data/flatpak-builder-1.0.11/src/builder-utils.c:1023:23:  [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 (comp_dir, name, enddir - name);
data/flatpak-builder-1.0.11/src/builder-utils.c:1418:8:  [2] (misc) open:
  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).
  fd = open (filename, O_RDONLY);
data/flatpak-builder-1.0.11/src/builder-utils.c:1687:27:  [2] (misc) open:
  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).
      blocking_stdin_fd = open ("/dev/null", O_RDONLY| O_CLOEXEC);
data/flatpak-builder-1.0.11/src/builder-utils.c:1851:34:  [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.
builder_get_all_checksums (const char *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-utils.c:1928:33:  [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.
builder_verify_checksums (const char *name,
data/flatpak-builder-1.0.11/src/builder-utils.c:1930:33:  [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.
                          const char *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-utils.c:2042:29:  [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.
                      const char     *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-utils.c:2534: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[32 * 1024];
data/flatpak-builder-1.0.11/src/builder-utils.h:93:38:  [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.
                               const char     *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-utils.h:98:40:  [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.
gsize builder_get_all_checksums (const char *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/src/builder-utils.h:105:42:  [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.
gboolean builder_verify_checksums (const char *name,
data/flatpak-builder-1.0.11/src/builder-utils.h:107:42:  [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.
                                   const char *checksums[BUILDER_CHECKSUMS_LEN],
data/flatpak-builder-1.0.11/libglnx/glnx-console.c:225:38:  [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).
  const guint input_textlen = text ? strlen (text) : 0;
data/flatpak-builder-1.0.11/libglnx/glnx-dirfd.c:266: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).
  const size_t len = strlen (tmpl);
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:348:25:  [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).
      char proc_fd_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(tmpf->fd) + 1];
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:470:22:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        bytes_read = read (fd, buf + buf_size, readlen);
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:839:33:  [1] (buffer) read:
  Check buffer boundaries if used in a loop including recursive loops
  (CWE-120, CWE-20).
        n = TEMP_FAILURE_RETRY (read (fdf, buf, m));
data/flatpak-builder-1.0.11/libglnx/glnx-fdio.c:1065:11:  [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 ((char*)buf);
data/flatpak-builder-1.0.11/libglnx/glnx-macros.h:44: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).
                        _len_ += strlen(_appendees_[_i_]);              \
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:57:12:  [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 (p) + 1;
data/flatpak-builder-1.0.11/libglnx/glnx-xattrs.c:87:44:  [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 (p = xattrs; p < xattrs+len; p = p + strlen (p) + 1)
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c:49:78:  [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 (!glnx_file_replace_contents_at (srcfd, "foo", (guint8*)"foo contents", strlen ("foo contents"),
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c:52:79:  [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 (!glnx_file_replace_contents_at (destfd, "bar", (guint8*)"bar contents", strlen ("bar contents"),
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c:124:40:  [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 (glnx_loop_write (tmpf.fd, "foo", strlen ("foo")) < 0)
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c:143: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).
  if (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello"))
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-fdio.c:143:51:  [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 (fwrite ("hello", 1, strlen ("hello"), f) != strlen ("hello"))
data/flatpak-builder-1.0.11/libglnx/tests/test-libglnx-xattrs.c:236:53:  [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 (fsetxattr (tmpdir.fd, "user.test", "novalue", strlen ("novalue"), 0) < 0)
data/flatpak-builder-1.0.11/src/builder-cache.c:1295:62:  [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).
    g_checksum_update (self->checksum, (const guchar *) str, strlen (str) + 1);
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:178:31:  [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).
              return string + strlen (string);
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:233: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 (m) == 4 && m[0] == 'i' && m[2] == '8'  && m[3] == '6')
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:370: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).
  rest = string + strlen (name);
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:1331:30:  [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).
      tmp = g_strndup (name, strlen (name) - 2);
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:1590:11:  [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 (filesystem);
data/flatpak-builder-1.0.11/src/builder-flatpak-utils.c:1688:15:  [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).
  gsize len = strlen (filesystem);
data/flatpak-builder-1.0.11/src/builder-git.c:89: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).
  p = output + strlen ("git version ");
data/flatpak-builder-1.0.11/src/builder-git.c:226:45:  [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).
          g_ascii_strncasecmp (commit, ref, strlen (ref)) == 0)
data/flatpak-builder-1.0.11/src/builder-git.c:230: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).
            full_ref[strlen (full_ref) - 3] = 0;
data/flatpak-builder-1.0.11/src/builder-git.c:306: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 (parent[strlen (parent) - 1] == '/')
data/flatpak-builder-1.0.11/src/builder-git.c:307:12:  [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).
    parent[strlen (parent) - 1] = 0;
data/flatpak-builder-1.0.11/src/builder-git.c:558: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).
                                        data, strlen (data),
data/flatpak-builder-1.0.11/src/builder-git.c:767:17:  [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 (submodule);
data/flatpak-builder-1.0.11/src/builder-main.c:335: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 (str);
data/flatpak-builder-1.0.11/src/builder-manifest.c:2252:44:  [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).
          (g_str_has_prefix (source_name + strlen (self->rename_icon), ".") ||
data/flatpak-builder-1.0.11/src/builder-manifest.c:2253:44:  [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).
           g_str_has_prefix (source_name + strlen (self->rename_icon), "-symbolic.")))
data/flatpak-builder-1.0.11/src/builder-manifest.c:2255:49:  [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).
          const char *extension = source_name + strlen (self->rename_icon);
data/flatpak-builder-1.0.11/src/builder-manifest.c:2949:85:  [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).
            command_file = g_file_resolve_relative_path (files_dir, self->command + strlen ("/app/"));
data/flatpak-builder-1.0.11/src/builder-manifest.c:3025: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).
                                json, strlen (json), error))
data/flatpak-builder-1.0.11/src/builder-manifest.c:3064:63:  [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).
                                          extension_contents, strlen (extension_contents),
data/flatpak-builder-1.0.11/src/builder-manifest.c:3077:56:  [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).
                                    metadata_contents, strlen (metadata_contents),
data/flatpak-builder-1.0.11/src/builder-manifest.c:3107:89:  [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 (!g_output_stream_write_all (G_OUTPUT_STREAM (output), extension_contents, strlen (extension_contents),
data/flatpak-builder-1.0.11/src/builder-manifest.c:3118:56:  [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).
                                    metadata_contents, strlen (metadata_contents), error))
data/flatpak-builder-1.0.11/src/builder-manifest.c:3148:56:  [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).
                                    metadata_contents, strlen (metadata_contents), error))
data/flatpak-builder-1.0.11/src/builder-manifest.c:3297:33:  [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).
              ext = groups[j] + strlen (FLATPAK_METADATA_GROUP_PREFIX_EXTENSION);
data/flatpak-builder-1.0.11/src/builder-manifest.c:3403:72:  [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).
          dest = g_file_resolve_relative_path (platform_dir, changed + strlen ("usr/"));
data/flatpak-builder-1.0.11/src/builder-manifest.c:3567:63:  [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).
                                          extension_contents, strlen (extension_contents),
data/flatpak-builder-1.0.11/src/builder-manifest.c:3579:56:  [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).
                                    metadata_contents, strlen (metadata_contents),
data/flatpak-builder-1.0.11/src/builder-manifest.c:3686:52:  [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).
                                metadata_contents, strlen (metadata_contents), error))
data/flatpak-builder-1.0.11/src/builder-manifest.c:3696: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).
                                json, strlen (json), error))
data/flatpak-builder-1.0.11/src/builder-module.c:1342: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).
      unprefixed_path = path + strlen (prefix);
data/flatpak-builder-1.0.11/src/builder-module.c:2120: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).
      unprefixed_path = path + strlen (prefix);
data/flatpak-builder-1.0.11/src/builder-module.c:2133:52:  [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).
          debug_path = g_strdup (unprefixed_path + strlen ("lib/debug/"));
data/flatpak-builder-1.0.11/src/builder-module.c:2134: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).
          debug_path[strlen (debug_path) - strlen (".debug")] = 0;
data/flatpak-builder-1.0.11/src/builder-module.c:2134:44:  [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).
          debug_path[strlen (debug_path) - strlen (".debug")] = 0;
data/flatpak-builder-1.0.11/src/builder-options.c:649:27:  [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.
              const char *equal;
data/flatpak-builder-1.0.11/src/builder-options.c:653:19:  [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)
data/flatpak-builder-1.0.11/src/builder-post-process.c:85: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).
  pyfilename[strlen (pyfilename) - 2] = 0; /* skip "py" */
data/flatpak-builder-1.0.11/src/builder-post-process.c:224: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).
      py_path = g_strndup (path, strlen (path) - 1);
data/flatpak-builder-1.0.11/src/builder-post-process.c:416:89:  [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).
          debug_dir = g_build_filename (app_dir_path, "files/lib/debug", rel_path_dir + strlen ("files/"), NULL);
data/flatpak-builder-1.0.11/src/builder-post-process.c:417:79:  [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).
          real_debug_dir = g_build_filename ("/app/lib/debug", rel_path_dir + strlen ("files/"), NULL);
data/flatpak-builder-1.0.11/src/builder-post-process.c:468:66:  [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).
                      const char *relative_path = file_refs[i] + strlen (builddir);
data/flatpak-builder-1.0.11/src/builder-utils.c:127:41:  [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).
          rest = slash ? slash : rest + strlen (rest);
data/flatpak-builder-1.0.11/src/builder-utils.c:481:68:  [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).
  yaml_parser_set_input_string (&parser, (yaml_char_t *) contents, strlen (contents));
data/flatpak-builder-1.0.11/src/builder-utils.c:860:41:  [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 comp_dir_len = !comp_dir ? 0 : strlen (comp_dir);
data/flatpak-builder-1.0.11/src/builder-utils.c:921:18:  [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).
      file_len = strlen (file);
data/flatpak-builder-1.0.11/src/builder-utils.c:922:17:  [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).
      dir_len = strlen ((char *) dirt[value]);

ANALYSIS SUMMARY:

Hits = 127
Lines analyzed = 30822 in approximately 0.74 seconds (41525 lines/second)
Physical Source Lines of Code (SLOC) = 23280
Hits@level = [0]   8 [1]  63 [2]  49 [3]  13 [4]   2 [5]   0
Hits@level+ = [0+] 135 [1+] 127 [2+]  64 [3+]  15 [4+]   2 [5+]   0
Hits/KSLOC@level+ = [0+] 5.79897 [1+] 5.45533 [2+] 2.74914 [3+] 0.64433 [4+] 0.0859107 [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.