[PATCH 1/1] efi_loader: fix efi_convert_device_path_to_text()

Heinrich Schuchardt heinrich.schuchardt at canonical.com
Tue Jul 26 07:45:18 CEST 2022


Ensure that the string we convert to UTF-16 is NUL terminated even
if the device path only contains end nodes.

Fixes: bd3d75bb0c58 ("efi_loader: multi part device paths to text")
Addresses-Coverity: 350434 ("Uninitialized scalar variable")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
---
 lib/efi_loader/efi_device_path_to_text.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
index 4d73954ef8..6c428ee061 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -432,6 +432,7 @@ static uint16_t EFIAPI *efi_convert_device_path_to_text(
 		*(u8 **)&device_path += device_path->length;
 	}
 
+	*str = 0;
 	text = efi_str_to_u16(buffer);
 
 out:
-- 
2.36.1



More information about the U-Boot mailing list