diff options
| author | Will Thompson <will@willthompson.co.uk> | 2019-09-26 13:29:03 +0100 |
|---|---|---|
| committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-09-26 12:51:50 +0000 |
| commit | 8ece6d12bb0aee4fb22789aadacda1242d3e693d (patch) | |
| tree | 10f12822305ac8458595d17d78db8677bb74df1e | |
| parent | aaac533ca4630b3efd2141bf38bbcc7699b2972d (diff) | |
| download | flatpak-auto.tar.gz | |
installation: don't dereference possibly-NULL arrayauto
If the installation contains 1 or more installed refs, but none of those
refs have a remote with a collection ID, then 'results' will be NULL but
'installed' will be non-NULL. Since
c29e686246086fa24a9cf9ba291d0e2f43420e06, 'results[0]' is used in this
situation – a NULL pointer dereference. There is an existing 'results !=
NULL' check inside the body of this loop, but this is too late.
Check whether 'results' is NULL before dereferencing it.
Fixes #3134.
Closes: #3135
Approved by: matthiasclasen
| -rw-r--r-- | common/flatpak-installation.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/flatpak-installation.c b/common/flatpak-installation.c index 0d9ac5fb..c821b97e 100644 --- a/common/flatpak-installation.c +++ b/common/flatpak-installation.c @@ -1145,7 +1145,7 @@ flatpak_installation_list_installed_refs_for_update (FlatpakInstallation *self, g_debug ("No remotes found which provide these refs: [%s]", refs_str->str); } - for (i = 0; i < installed->len && results[0] != NULL; i++) + for (i = 0; i < installed->len && results != NULL && results[0] != NULL; i++) { FlatpakInstalledRef *installed_ref = g_ptr_array_index (installed, i); const char *remote_name = flatpak_installed_ref_get_origin (installed_ref); |
