diff options
Diffstat (limited to 'lib/efi_loader/efi_device_path_to_text.c')
-rw-r--r-- | lib/efi_loader/efi_device_path_to_text.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index b20b7c097c9..0f3796b373b 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -29,15 +29,15 @@ const efi_guid_t efi_guid_device_path_to_text_protocol = static u16 *efi_str_to_u16(char *str) { efi_uintn_t len; - u16 *out; + u16 *out, *dst; efi_status_t ret; - len = strlen(str) + 1; - ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len * sizeof(u16), - (void **)&out); + len = sizeof(u16) * (utf8_utf16_strlen(str) + 1); + ret = efi_allocate_pool(EFI_ALLOCATE_ANY_PAGES, len, (void **)&out); if (ret != EFI_SUCCESS) return NULL; - ascii2unicode(out, str); + dst = out; + utf8_utf16_strcpy(&dst, str); return out; } |