summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--portal/flatpak-portal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/portal/flatpak-portal.c b/portal/flatpak-portal.c
index df08849a..9589415e 100644
--- a/portal/flatpak-portal.c
+++ b/portal/flatpak-portal.c
@@ -919,7 +919,7 @@ handle_spawn (PortalFlatpak *object,
g_variant_get_child (arg_fds, i, "{uh}", &dest_fd, &handle);
- if (handle >= fds_len)
+ if (handle >= fds_len || handle < 0)
{
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
@@ -1138,7 +1138,7 @@ handle_spawn (PortalFlatpak *object,
{
gint32 handle;
g_variant_get_child (sandbox_expose_fd, i, "h", &handle);
- if (handle < fds_len)
+ if (handle >= 0 && handle < fds_len)
{
int handle_fd = fds[handle];
g_autofree char *path = NULL;
@@ -1166,7 +1166,7 @@ handle_spawn (PortalFlatpak *object,
{
gint32 handle;
g_variant_get_child (sandbox_expose_fd_ro, i, "h", &handle);
- if (handle < fds_len)
+ if (handle >= 0 && handle < fds_len)
{
int handle_fd = fds[handle];
g_autofree char *path = NULL;