Index: cgpt/cmd_find.c |
diff --git a/cgpt/cmd_find.c b/cgpt/cmd_find.c |
index 40f10ba0afad567b6b39e8af8253fb7e6e82e9d0..43438ef77cd8c2049d3229d38f33aa8ea6008433 100644 |
--- a/cgpt/cmd_find.c |
+++ b/cgpt/cmd_find.c |
@@ -181,8 +181,12 @@ static int do_search(char *filename) { |
(set_type && !memcmp(&type_guid, &entry->type, sizeof(Guid)))) { |
found = 1; |
} else if (set_label) { |
- UTF16ToUTF8(entry->name, sizeof(entry->name) / sizeof(entry->name[0]), |
- (uint8_t *)partlabel, sizeof(partlabel)); |
+ if (CGPT_OK != UTF16ToUTF8(entry->name, |
+ sizeof(entry->name) / sizeof(entry->name[0]), |
+ (uint8_t *)partlabel, sizeof(partlabel))) { |
+ Error("The label cannot be converted to UTF16, so abort.\n"); |
+ return 0; |
+ } |
if (!strncmp(label, partlabel, sizeof(partlabel))) { |
found = 1; |
} |