Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1475)

Unified Diff: cgpt/cmd_find.c

Issue 5025003: The right implementation of CGPT label conversion between UTF8 and UTF16. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: Fixed per code review opinion. Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cgpt/cmd_add.c ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « cgpt/cmd_add.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698