From 66fcf55f9ae5c41fa5371203774538dd4e19c92c Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 18 Nov 2019 16:22:01 -0600 Subject: [PATCH] trivial: uefi: correct a NULL pointer dereference This could happen if the machine doesn't have `/etc/os-release`. --- plugins/uefi/fu-uefi-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/uefi/fu-uefi-common.c b/plugins/uefi/fu-uefi-common.c index eddb2a54e..4e7084fb0 100644 --- a/plugins/uefi/fu-uefi-common.c +++ b/plugins/uefi/fu-uefi-common.c @@ -260,7 +260,7 @@ fu_uefi_get_esp_path_for_os (const gchar *base) os_release_id = "unknown"; /* if ID key points at something existing return it */ esp_path = g_build_filename (base, "EFI", os_release_id, NULL); - if (g_file_test (esp_path, G_FILE_TEST_IS_DIR)) + if (g_file_test (esp_path, G_FILE_TEST_IS_DIR) || os_release == NULL) return g_steal_pointer (&esp_path); /* if ID key doesn't exist, try ID_LIKE */ id_like_id = g_hash_table_lookup (os_release, "ID_LIKE");