diff options
author | Simon McVittie <smcv@collabora.com> | 2020-12-08 17:57:01 +0000 |
---|---|---|
committer | Alexander Larsson <alexander.larsson@gmail.com> | 2020-12-09 08:44:27 +0100 |
commit | 1fb8a6802056d260a6673fac91fbc2cf05d6068a (patch) | |
tree | db326234f15e5e62ac84d21157a4e3a896b95fdb /portal | |
parent | 5562c921e8c5f1907de0ee501b341bd830f9e449 (diff) | |
download | flatpak-1fb8a6802056d260a6673fac91fbc2cf05d6068a.tar.gz |
portal: Negative handles are an error
Always treat a negative handle as being out-of-range.
Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'portal')
-rw-r--r-- | portal/flatpak-portal.c | 6 |
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; |