diff options
author | Bill Richardson <wfrichar@chromium.org> | 2010-10-12 07:33:15 -0700 |
---|---|---|
committer | Bill Richardson <wfrichar@chromium.org> | 2010-10-12 07:33:15 -0700 |
commit | c4e92af85ac2bfd90ab82c0b13bb0041595a0aff (patch) | |
tree | 5ff40795b6727f5aedd7a9f4101a76198ca29869 /cgpt/cmd_create.c | |
parent | 2845b97df68da9387c400fb1eca5f6dbce1ddefa (diff) | |
download | vboot-c4e92af85ac2bfd90ab82c0b13bb0041595a0aff.tar.gz |
Address some security concerns in the cgpt tool.
1. Check for potential integer overflow in sector_bytes * sector_count.
2. Added O_NOFOLLOW to open() call - Is this enough?
3. Passing buffer length to GuidToStr(), PMBRToStr().
4. Use unsigned int in GetEntry() to determine stride.
5. Address conversion between UTF16 and UTF8.
Note: The UTF conversion is complex and troublesome, and needs careful
consideration to get right. For now, I've just forced the interpretation of
the partition name to 7-bit ASCII. That's sufficient for the needs of Chrome
OS, and I can file a new issue to handle UTF correctly.
BUG=chrome-os-partner:705
TEST=manual
Running "make runtests" invokes the tests/run_cgpt_tests.sh script, which checks the behavior and output of the cgpt tool.
Review URL: http://codereview.chromium.org/3594010
Change-Id: I5fd29796d8c929527e0cfbc6d5ccbcdc77502c6b
Diffstat (limited to 'cgpt/cmd_create.c')
-rw-r--r-- | cgpt/cmd_create.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cgpt/cmd_create.c b/cgpt/cmd_create.c index 16803709..6dabde3a 100644 --- a/cgpt/cmd_create.c +++ b/cgpt/cmd_create.c @@ -24,7 +24,7 @@ static void Usage(void) int cmd_create(int argc, char *argv[]) { struct drive drive; int zap = 0; - + int c; int errorcnt = 0; @@ -76,7 +76,7 @@ int cmd_create(int argc, char *argv[]) { drive.gpt.sector_bytes * GPT_ENTRIES_SECTORS); memset(drive.gpt.secondary_entries, 0, drive.gpt.sector_bytes * GPT_ENTRIES_SECTORS); - + drive.gpt.modified |= (GPT_MODIFIED_HEADER1 | GPT_MODIFIED_ENTRIES1 | GPT_MODIFIED_HEADER2 | GPT_MODIFIED_ENTRIES2); |