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/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-format.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/permission-db.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/permission-db.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-portal.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-portal.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/file-transfer.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/file-transfer.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-enums.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-store.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-store.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.h
Examining data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/permission-store.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/xdg-permission-store.c
Examining data/xdg-desktop-portal-1.8.0/document-portal/xdg-permission-store.h
Examining data/xdg-desktop-portal-1.8.0/src/xdg-desktop-portal.c
Examining data/xdg-desktop-portal-1.8.0/src/file-chooser.c
Examining data/xdg-desktop-portal-1.8.0/src/file-chooser.h
Examining data/xdg-desktop-portal-1.8.0/src/open-uri.c
Examining data/xdg-desktop-portal-1.8.0/src/open-uri.h
Examining data/xdg-desktop-portal-1.8.0/src/print.c
Examining data/xdg-desktop-portal-1.8.0/src/print.h
Examining data/xdg-desktop-portal-1.8.0/src/memory-monitor.c
Examining data/xdg-desktop-portal-1.8.0/src/memory-monitor.h
Examining data/xdg-desktop-portal-1.8.0/src/network-monitor.c
Examining data/xdg-desktop-portal-1.8.0/src/network-monitor.h
Examining data/xdg-desktop-portal-1.8.0/src/proxy-resolver.c
Examining data/xdg-desktop-portal-1.8.0/src/proxy-resolver.h
Examining data/xdg-desktop-portal-1.8.0/src/screenshot.c
Examining data/xdg-desktop-portal-1.8.0/src/screenshot.h
Examining data/xdg-desktop-portal-1.8.0/src/notification.h
Examining data/xdg-desktop-portal-1.8.0/src/inhibit.c
Examining data/xdg-desktop-portal-1.8.0/src/inhibit.h
Examining data/xdg-desktop-portal-1.8.0/src/device.c
Examining data/xdg-desktop-portal-1.8.0/src/device.h
Examining data/xdg-desktop-portal-1.8.0/src/account.c
Examining data/xdg-desktop-portal-1.8.0/src/account.h
Examining data/xdg-desktop-portal-1.8.0/src/request.c
Examining data/xdg-desktop-portal-1.8.0/src/request.h
Examining data/xdg-desktop-portal-1.8.0/src/call.c
Examining data/xdg-desktop-portal-1.8.0/src/call.h
Examining data/xdg-desktop-portal-1.8.0/src/documents.c
Examining data/xdg-desktop-portal-1.8.0/src/documents.h
Examining data/xdg-desktop-portal-1.8.0/src/permissions.c
Examining data/xdg-desktop-portal-1.8.0/src/permissions.h
Examining data/xdg-desktop-portal-1.8.0/src/email.c
Examining data/xdg-desktop-portal-1.8.0/src/email.h
Examining data/xdg-desktop-portal-1.8.0/src/settings.c
Examining data/xdg-desktop-portal-1.8.0/src/settings.h
Examining data/xdg-desktop-portal-1.8.0/src/session.c
Examining data/xdg-desktop-portal-1.8.0/src/session.h
Examining data/xdg-desktop-portal-1.8.0/src/trash.c
Examining data/xdg-desktop-portal-1.8.0/src/trash.h
Examining data/xdg-desktop-portal-1.8.0/src/wallpaper.c
Examining data/xdg-desktop-portal-1.8.0/src/wallpaper.h
Examining data/xdg-desktop-portal-1.8.0/src/xdp-utils.c
Examining data/xdg-desktop-portal-1.8.0/src/xdp-utils.h
Examining data/xdg-desktop-portal-1.8.0/src/background.c
Examining data/xdg-desktop-portal-1.8.0/src/background.h
Examining data/xdg-desktop-portal-1.8.0/src/gamemode.c
Examining data/xdg-desktop-portal-1.8.0/src/gamemode.h
Examining data/xdg-desktop-portal-1.8.0/src/secret.c
Examining data/xdg-desktop-portal-1.8.0/src/secret.h
Examining data/xdg-desktop-portal-1.8.0/src/flatpak-instance.c
Examining data/xdg-desktop-portal-1.8.0/src/flatpak-instance.h
Examining data/xdg-desktop-portal-1.8.0/src/portal-impl.h
Examining data/xdg-desktop-portal-1.8.0/src/portal-impl.c
Examining data/xdg-desktop-portal-1.8.0/src/screen-cast.c
Examining data/xdg-desktop-portal-1.8.0/src/screen-cast.h
Examining data/xdg-desktop-portal-1.8.0/src/remote-desktop.c
Examining data/xdg-desktop-portal-1.8.0/src/remote-desktop.h
Examining data/xdg-desktop-portal-1.8.0/src/pipewire.c
Examining data/xdg-desktop-portal-1.8.0/src/pipewire.h
Examining data/xdg-desktop-portal-1.8.0/src/camera.c
Examining data/xdg-desktop-portal-1.8.0/src/camera.h
Examining data/xdg-desktop-portal-1.8.0/src/location.c
Examining data/xdg-desktop-portal-1.8.0/src/location.h
Examining data/xdg-desktop-portal-1.8.0/src/notification.c
Examining data/xdg-desktop-portal-1.8.0/src/validate-icon.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/test-backends.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/request.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/request.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/session.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/session.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/access.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/access.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/account.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/account.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/appchooser.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/appchooser.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/background.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/background.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/email.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/email.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/filechooser.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/filechooser.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/inhibit.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/inhibit.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/lockdown.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/lockdown.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/notification.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/notification.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/print.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/print.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/screenshot.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/screenshot.h
Examining data/xdg-desktop-portal-1.8.0/tests/backend/wallpaper.c
Examining data/xdg-desktop-portal-1.8.0/tests/backend/wallpaper.h
Examining data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c
Examining data/xdg-desktop-portal-1.8.0/tests/test-permission-store.c
Examining data/xdg-desktop-portal-1.8.0/tests/test-portals.c
Examining data/xdg-desktop-portal-1.8.0/tests/account.c
Examining data/xdg-desktop-portal-1.8.0/tests/account.h
Examining data/xdg-desktop-portal-1.8.0/tests/background.c
Examining data/xdg-desktop-portal-1.8.0/tests/background.h
Examining data/xdg-desktop-portal-1.8.0/tests/camera.c
Examining data/xdg-desktop-portal-1.8.0/tests/camera.h
Examining data/xdg-desktop-portal-1.8.0/tests/email.c
Examining data/xdg-desktop-portal-1.8.0/tests/email.h
Examining data/xdg-desktop-portal-1.8.0/tests/filechooser.c
Examining data/xdg-desktop-portal-1.8.0/tests/filechooser.h
Examining data/xdg-desktop-portal-1.8.0/tests/inhibit.c
Examining data/xdg-desktop-portal-1.8.0/tests/inhibit.h
Examining data/xdg-desktop-portal-1.8.0/tests/location.c
Examining data/xdg-desktop-portal-1.8.0/tests/location.h
Examining data/xdg-desktop-portal-1.8.0/tests/notification.c
Examining data/xdg-desktop-portal-1.8.0/tests/notification.h
Examining data/xdg-desktop-portal-1.8.0/tests/openuri.c
Examining data/xdg-desktop-portal-1.8.0/tests/openuri.h
Examining data/xdg-desktop-portal-1.8.0/tests/print.c
Examining data/xdg-desktop-portal-1.8.0/tests/print.h
Examining data/xdg-desktop-portal-1.8.0/tests/screenshot.c
Examining data/xdg-desktop-portal-1.8.0/tests/screenshot.h
Examining data/xdg-desktop-portal-1.8.0/tests/trash.c
Examining data/xdg-desktop-portal-1.8.0/tests/trash.h
Examining data/xdg-desktop-portal-1.8.0/tests/wallpaper.c
Examining data/xdg-desktop-portal-1.8.0/tests/wallpaper.h
Examining data/xdg-desktop-portal-1.8.0/tests/utils.c
Examining data/xdg-desktop-portal-1.8.0/tests/utils.h
Examining data/xdg-desktop-portal-1.8.0/tests/glib-backports.c
Examining data/xdg-desktop-portal-1.8.0/tests/glib-backports.h
Examining data/xdg-desktop-portal-1.8.0/tests/testdb.c

FINAL RESULTS:

data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1458:17:  [5] (race) chown:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchown( ) instead.
          res = chown (path, uid, gid);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1478:17:  [5] (race) chmod:
  This accepts filename arguments; if an attacker can move those files, a
  race condition results. (CWE-362). Use fchmod( ) instead.
          res = chmod (path, attr->st_mode);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:3358:26:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
          symlink_size = readlink (fd_path, path_buffer, PATH_MAX);
data/xdg-desktop-portal-1.8.0/src/validate-icon.c:145:18:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
  symlink_size = readlink ("/proc/self/exe", validate_icon, sizeof (validate_icon) - 1);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:867:18:  [5] (race) readlink:
  This accepts filename arguments; if an attacker can move those files or
  change the link content, a race condition results. Also, it does not
  terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach.
  symlink_size = readlink (proc_path, path_buffer, PATH_MAX);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:2651:13:  [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.
      res = access (path, mask);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:2663:15:  [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.
        res = access (inode->domain->doc_path, mask);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:962:11:  [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 (proc_path, read_access_mode) != 0)
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:965:46:  [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 (xdp_app_info_is_host (app_info) || access (proc_path, W_OK) == 0)
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:718: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 ("/dev/fuse", W_OK) != 0)
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:950: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/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:3071: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.
  status = getenv ("TEST_DOCUMENT_PORTAL_FUSE_STATUS");
data/xdg-desktop-portal-1.8.0/document-portal/document-portal.c:325: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.
      id = xdp_name_from_id ((guint32) g_random_int ());
data/xdg-desktop-portal-1.8.0/document-portal/document-portal.c:609:40:  [3] (buffer) g_get_home_dir:
  This function is synonymous with 'getenv("HOME")';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.
  homedir = xdp_canonicalize_filename (g_get_home_dir ());
data/xdg-desktop-portal-1.8.0/document-portal/file-transfer.c:172:11:  [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.
    key = g_random_int ();
data/xdg-desktop-portal-1.8.0/document-portal/file-transfer.c:173:25:  [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.
    key = (key << 32) | g_random_int ();
data/xdg-desktop-portal-1.8.0/src/request.c:372:11:  [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.
      r = g_random_int ();
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:887:11:  [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).
  dirfd = open (domain->doc_path, O_PATH | O_DIRECTORY);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1047:15:  [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).
  o_path_fd = open (real_fd_path, O_PATH, 0);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1148:20:  [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 (fd_path, open_flags & ~(O_CREAT|O_EXCL|O_NOFOLLOW), mode);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1802: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, open_flags, 0);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1846:15:  [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).
  o_path_fd = open (fd_path, O_PATH, 0);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:2707: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 linkname[PATH_MAX + 1];
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:3352: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 path_buffer[PATH_MAX + 1];
data/xdg-desktop-portal-1.8.0/document-portal/document-portal.c:387: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).
  dir_fd = open (dirname, O_CLOEXEC | O_PATH);
data/xdg-desktop-portal-1.8.0/document-portal/document-portal.c:1188: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_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/document-portal/file-transfer.c:288:16:  [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).
      fds[i] = open (file->path, O_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c:295:5:  [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 (chunk->data, string, length);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c:332: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 (chunk (sizeof bloom_hdr), &bloom_hdr, sizeof bloom_hdr);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c:333: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 (chunk (sizeof table_hdr), &table_hdr, sizeof table_hdr);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.c:278:47:  [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.
    hash_value = (hash_value * 33) + ((signed char *) key)[key_length];
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.c:436:19:  [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 (fullname, parent_name, parent_length);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.c:437:19:  [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 (fullname + parent_length, name, name_length);
data/xdg-desktop-portal-1.8.0/src/background.c:173: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 *permissions[2];
data/xdg-desktop-portal-1.8.0/src/documents.c:68: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 *permissions[5];
data/xdg-desktop-portal-1.8.0/src/documents.c:84:10:  [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 (dirname, O_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/src/documents.c:86:10:  [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_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/src/location.c:367: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 *permissions[3];
data/xdg-desktop-portal-1.8.0/src/notification.c:370: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 *args[6];
data/xdg-desktop-portal-1.8.0/src/open-uri.c:97:21:  [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).
      perms_count = atoi (permissions[PERM_APP_COUNT]);
data/xdg-desktop-portal-1.8.0/src/open-uri.c:102:31:  [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).
            perms_threshold = atoi (permissions[PERM_APP_THRESHOLD]);
data/xdg-desktop-portal-1.8.0/src/validate-icon.c:142: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 validate_icon[PATH_MAX + 1];
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:864: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_buffer[PATH_MAX + 1];
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1461: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[20] = {0, };
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1481: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 ("/proc/self/fdinfo", O_RDONLY | O_NONBLOCK | O_DIRECTORY | O_CLOEXEC | O_NOCTTY);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1595: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 (pids, res, sizeof (pid_t) * n_pids);
data/xdg-desktop-portal-1.8.0/tests/backend/email.c:44: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 *no_att[1] = { NULL };
data/xdg-desktop-portal-1.8.0/tests/camera.c:21: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 *permissions[2] = { NULL, NULL };
data/xdg-desktop-portal-1.8.0/tests/email.c:55: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 *addresses[2] = { "mclasen@redhat.com", NULL };
data/xdg-desktop-portal-1.8.0/tests/email.c:97: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 *addresses[2];;
data/xdg-desktop-portal-1.8.0/tests/email.c:210: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 *addresses[2];
data/xdg-desktop-portal-1.8.0/tests/email.c:258: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 *addresses[2];
data/xdg-desktop-portal-1.8.0/tests/email.c:319: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 *addresses[2];
data/xdg-desktop-portal-1.8.0/tests/email.c:367: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 *addresses[2];
data/xdg-desktop-portal-1.8.0/tests/openuri.c:27: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 *permissions[4];
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:42: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_RDWR | O_TRUNC | O_CREAT, 0644);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.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);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:153: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);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:168: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);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:183: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 (dir, O_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:222: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_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:526:9:  [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).
  fd1 = open (path1, O_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:533:9:  [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).
  fd2 = open (path2, O_PATH | O_CLOEXEC);
data/xdg-desktop-portal-1.8.0/tests/test-portals.c:130: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 *argv[4];
data/xdg-desktop-portal-1.8.0/tests/testdb.c:186:8:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  char tmpfile[] = "/tmp/testdbXXXXXX";
data/xdg-desktop-portal-1.8.0/tests/testdb.c:207:19:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  fd = g_mkstemp (tmpfile);
data/xdg-desktop-portal-1.8.0/tests/testdb.c:210:31:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  permission_db_set_path (db, tmpfile);
data/xdg-desktop-portal-1.8.0/tests/testdb.c:215:28:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  db2 = permission_db_new (tmpfile, TRUE, &error);
data/xdg-desktop-portal-1.8.0/tests/testdb.c:223:11:  [2] (tmpfile) tmpfile:
  Function tmpfile() has a security flaw on some systems (e.g., older System
  V systems) (CWE-377).
  unlink (tmpfile);
data/xdg-desktop-portal-1.8.0/tests/wallpaper.c:17: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 *permissions[2] = { NULL, NULL };
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:683: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).
    g_checksum_update (checksum, (guchar *)doc_id, strlen (doc_id));
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:685: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).
    g_checksum_update (checksum, (guchar *)app_id, strlen (app_id));
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:941: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/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:1672:80:  [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).
    fuse_lowlevel_notify_inval_entry (main_ch, parent_ino, doc_domain->doc_id, strlen (doc_domain->doc_id));
data/xdg-desktop-portal-1.8.0/document-portal/document-portal-fuse.c:3280:67:  [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).
                                            invalidate->filename, strlen (invalidate->filename));
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c:288: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).
  length = strlen (string);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-builder.c:390:36:  [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).
            basename = item->key + strlen (item->parent->key);
data/xdg-desktop-portal-1.8.0/document-portal/gvdb/gvdb-reader.c:434:35:  [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_length = strlen (parent_name);
data/xdg-desktop-portal-1.8.0/src/open-uri.c:209: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).
  return g_strndup (desktop_id, strlen (desktop_id) - strlen (".desktop"));
data/xdg-desktop-portal-1.8.0/src/open-uri.c:209:55:  [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 g_strndup (desktop_id, strlen (desktop_id) - strlen (".desktop"));
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:308:23:  [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).
        path = path + strlen ("/newroot");
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:311: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).
        return g_build_filename (app_path, path + strlen ("/app/"), NULL);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:313:55:  [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 g_build_filename (runtime_path, path + strlen ("/usr/"), NULL);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:315: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).
        return g_build_filename ("/usr", path + strlen ("/run/host/usr/"), NULL);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:317: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).
        return g_build_filename ("/etc", path + strlen ("/run/host/etc/"), NULL);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:510: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).
#define UNCONFINED_SIZE		strlen(UNCONFINED)
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:524: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).
  int size = strlen (con);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1024: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 (string);
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1408: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).
    if (!strncmp (key, "NSpid", strlen ("NSpid")))
data/xdg-desktop-portal-1.8.0/src/xdp-utils.c:1413:36:  [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).
    else if (!strncmp (key, "Uid", strlen ("Uid")))
data/xdg-desktop-portal-1.8.0/tests/openuri.c:164:48:  [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).
  app_id = g_strndup (g_app_info_get_id (app), strlen (g_app_info_get_id (app)) - strlen (".desktop"));
data/xdg-desktop-portal-1.8.0/tests/openuri.c:164:83:  [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).
  app_id = g_strndup (g_app_info_get_id (app), strlen (g_app_info_get_id (app)) - strlen (".desktop"));
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:40: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).
    length = strlen (contents);
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:109: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).
  g_assert_cmpuint (real_contents_length, ==, strlen (expected_contents));
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:123: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).
  g_assert_cmpuint (real_contents_length, ==, strlen (expected_contents));
data/xdg-desktop-portal-1.8.0/tests/test-doc-portal.c:892: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).
      if (strlen (fuse_unmount_status) > 0)
data/xdg-desktop-portal-1.8.0/tests/test-portals.c:104: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).
      len = strlen (data_dirs);

ANALYSIS SUMMARY:

Hits = 97
Lines analyzed = 37412 in approximately 0.76 seconds (49004 lines/second)
Physical Source Lines of Code (SLOC) = 28074
Hits@level = [0]  13 [1]  27 [2]  53 [3]   7 [4]   5 [5]   5
Hits@level+ = [0+] 110 [1+]  97 [2+]  70 [3+]  17 [4+]  10 [5+]   5
Hits/KSLOC@level+ = [0+] 3.91822 [1+] 3.45515 [2+] 2.49341 [3+] 0.605542 [4+] 0.356201 [5+] 0.178101
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.