]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-boot: Fix possible null pointer dereference
authorJan Janssen <medhefgo@web.de>
Wed, 11 Aug 2021 12:59:46 +0000 (14:59 +0200)
committerJan Janssen <medhefgo@web.de>
Thu, 12 Aug 2021 07:48:37 +0000 (09:48 +0200)
Auto entries are showing garbage for the version in print_status()
because StrDuplicate does not expect null pointers.

src/boot/efi/boot.c

index d0a3bce159d6eefe1f9b7eabaa94f32be5e20d97..54d704f0d13629e8cf66681f2b67ab3a11d1c1a0 100644 (file)
@@ -1722,7 +1722,7 @@ static ConfigEntry *config_entry_add_loader(
         *entry = (ConfigEntry) {
                 .type = type,
                 .title = StrDuplicate(title),
-                .version = StrDuplicate(version),
+                .version = version ? StrDuplicate(version) : NULL,
                 .device = device,
                 .loader = StrDuplicate(loader),
                 .id = StrDuplicate(id),