Use efi_convert_string() to convert a UTF-8 to a UTF-16 string.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
char *endp;
u16 var_name16[9];
efi_guid_t guid;
char *endp;
u16 var_name16[9];
efi_guid_t guid;
- size_t label_len, label_len16;
u16 *label;
struct efi_device_path *file_path = NULL;
struct efi_device_path *fp_free = NULL;
u16 *label;
struct efi_device_path *file_path = NULL;
struct efi_device_path *fp_free = NULL;
- label_len = strlen(argv[2]);
- label_len16 = utf8_utf16_strnlen(argv[2], label_len);
- label = malloc((label_len16 + 1) * sizeof(u16));
+ label = efi_convert_string(argv[2]);
if (!label)
return CMD_RET_FAILURE;
lo.label = label; /* label will be changed below */
if (!label)
return CMD_RET_FAILURE;
lo.label = label; /* label will be changed below */
- utf8_utf16_strncpy(&label, argv[2], label_len);
/* file path */
ret = efi_dp_from_name(argv[3], argv[4], argv[5],
/* file path */
ret = efi_dp_from_name(argv[3], argv[4], argv[5],