1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

stub: get_extra_dir() can return NULL

If we have a device path that is not the usual file system directory
get_extra_dir() will return NULL. Handle that gracefully.

Fixes: #30228
This commit is contained in:
Lennart Poettering 2023-11-28 21:21:37 +01:00 committed by Luca Boccassi
parent 0e38893a0f
commit ec43827bf7
2 changed files with 6 additions and 3 deletions

View File

@ -339,8 +339,11 @@ EFI_STATUS pack_cpio(
if (err != EFI_SUCCESS)
return log_error_status(err, "Unable to open root directory: %m");
if (!dropin_dir)
if (!dropin_dir) {
dropin_dir = rel_dropin_dir = get_extra_dir(loaded_image->FilePath);
if (!dropin_dir)
goto nothing;
}
err = open_directory(root, dropin_dir, &extra_dir);
if (err == EFI_NOT_FOUND)

View File

@ -556,8 +556,8 @@ static EFI_STATUS run(EFI_HANDLE image) {
log_error_status(err, "Error loading global addons, ignoring: %m");
/* Some bootloaders always pass NULL in FilePath, so we need to check for it here. */
if (loaded_image->FilePath) {
_cleanup_free_ char16_t *dropin_dir = get_extra_dir(loaded_image->FilePath);
_cleanup_free_ char16_t *dropin_dir = get_extra_dir(loaded_image->FilePath);
if (dropin_dir) {
err = load_addons(
image,
loaded_image,