diff options
author | Nick Sanders <nsanders@chromium.org> | 2011-06-28 17:47:42 -0700 |
---|---|---|
committer | Nick Sanders <nsanders@chromium.org> | 2011-07-20 23:37:59 -0700 |
commit | 36dccdbad1c88657ee893b794b5aba2feacefaa5 (patch) | |
tree | 0b5ce28b1e10a017d43aecee69961523c2869609 /host | |
parent | 04b7978c4682c8b65aa9a212ff2a7d0071336b22 (diff) | |
download | vboot-36dccdbad1c88657ee893b794b5aba2feacefaa5.tar.gz |
Add check to validate VbSharedData magic
TEST=run crossystem
BUG=chrome-os-partner:4691
Change-Id: If590d185446dfa7cb628b5014f3a9a9c7b7a901d
Reviewed-on: http://gerrit.chromium.org/gerrit/3355
Reviewed-by: Nick Sanders <nsanders@chromium.org>
Tested-by: Nick Sanders <nsanders@chromium.org>
Diffstat (limited to 'host')
-rw-r--r-- | host/arch/arm/lib/crossystem_arch.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/host/arch/arm/lib/crossystem_arch.c b/host/arch/arm/lib/crossystem_arch.c index 554fe810..7e6095eb 100644 --- a/host/arch/arm/lib/crossystem_arch.c +++ b/host/arch/arm/lib/crossystem_arch.c @@ -276,6 +276,13 @@ VbSharedDataHeader *VbSharedDataRead(void) { size_t size = 0; if (ReadFdtBlock("vboot-shared-data", &block, &size)) return NULL; + VbSharedDataHeader *p = (VbSharedDataHeader *)block; + if (p->magic != VB_SHARED_DATA_MAGIC) { + fprintf(stderr, "%s: failed to validate magic in " + "VbSharedDataHeader (%x != %x)\n", + __FUNCTION__, p->magic, VB_SHARED_DATA_MAGIC); + return NULL; + } return (VbSharedDataHeader *)block; } |