Index: cgpt/cmd_add.c |
diff --git a/cgpt/cmd_add.c b/cgpt/cmd_add.c |
index dafcc50fba85258221cf06af5bb78e946395a365..81b0dfa10cfee06ade1903e2e162802909687a45 100644 |
--- a/cgpt/cmd_add.c |
+++ b/cgpt/cmd_add.c |
@@ -251,8 +251,11 @@ int cmd_add(int argc, char *argv[]) { |
if (set_unique) |
memcpy(&entry->unique, &unique_guid, sizeof(Guid)); |
if (label) { |
- UTF8ToUTF16((uint8_t *)label, entry->name, |
- sizeof(entry->name) / sizeof(entry->name[0])); |
+ if (CGPT_OK != UTF8ToUTF16((uint8_t *)label, entry->name, |
+ sizeof(entry->name) / sizeof(entry->name[0]))) { |
+ Error("The label cannot be converted to UTF16.\n"); |
+ goto bad; |
+ } |
} |
if (set_raw) { |
entry->attrs.fields.gpt_att = raw_value; |