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

Unified Diff: cgpt/cmd_add.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/cgpt_common.c ('k') | cgpt/cmd_find.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « cgpt/cgpt_common.c ('k') | cgpt/cmd_find.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698