From e274bafc019db147e0fa85e8b2e100ee0570cd59 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 20 Jan 2021 21:40:39 +0000 Subject: [PATCH] flatpak-dir: Fix crash on updating app with no deploy data or subpaths If an app had no deploy data, and `flatpak_dir_update()` was called with `opt_subpaths == NULL`, then `arg_subpaths` passed to `flatpak_dir_system_helper_call_deploy()` would be `NULL`, which causes an assertion failure from an internal `g_variant_new()` call: ``` g_variant_new_strv: assertion 'length == 0 || strv != NULL' failed ``` Fix that by setting the `subpaths` to an empty array if nothing else is specified. Signed-off-by: Philip Withnall --- common/flatpak-dir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 9f749b73..252d8ac7 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -9684,6 +9684,7 @@ flatpak_dir_update (FlatpakDir *self, { g_autoptr(GBytes) deploy_data = NULL; const char **subpaths = NULL; + const char *empty_subpaths[] = {NULL}; g_autofree char *url = NULL; FlatpakPullFlags flatpak_flags; g_autofree const char **old_subpaths = NULL; @@ -9706,8 +9707,10 @@ flatpak_dir_update (FlatpakDir *self, if (opt_subpaths) subpaths = opt_subpaths; - else + else if (old_subpaths) subpaths = old_subpaths; + else + subpaths = empty_subpaths; if (!ostree_repo_remote_get_url (self->repo, state->remote_name, &url, error)) return FALSE;