sd-boot: don't dereference NULL ptr if loaded_image_path is NULL
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Feb 2019 12:03:26 +0000 (13:03 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 1 Mar 2019 11:41:32 +0000 (12:41 +0100)
In a follow-up commit we'd like to invoke config_entry_add_from_file()
on partitions that are not the ESP, let's prepare fpr that and allow
loaded_image_path to be passed as NULL.

src/boot/efi/boot.c

index 909e4b0..35c649f 100644 (file)
@@ -1316,7 +1316,7 @@ static VOID config_entry_add_from_file(
                         entry->loader = stra_to_path(value);
 
                         /* do not add an entry for ourselves */
-                        if (StriCmp(entry->loader, loaded_image_path) == 0) {
+                        if (loaded_image_path && StriCmp(entry->loader, loaded_image_path) == 0) {
                                 entry->type = LOADER_UNDEFINED;
                                 break;
                         }