aboutsummaryrefslogtreecommitdiffstats
path: root/bootloader.c
diff options
context:
space:
mode:
authorAdam Bliss <abliss@google.com>2011-07-13 15:13:54 -0700
committerAdam Bliss <abliss@google.com>2011-07-13 15:24:38 -0700
commitb2ceb696d02ab0f9f297033820a51fdeac12c0af (patch)
treed50097758848e4ac9ac7710efaaeb530fdc42943 /bootloader.c
parent28a08efe15fc14bf1f4937024d4b73cf299313e5 (diff)
downloadbootable_recovery-b2ceb696d02ab0f9f297033820a51fdeac12c0af.zip
bootable_recovery-b2ceb696d02ab0f9f297033820a51fdeac12c0af.tar.gz
bootable_recovery-b2ceb696d02ab0f9f297033820a51fdeac12c0af.tar.bz2
Check pointer for null before dereferencing
Change-Id: Ie7563bf8fb2d627454010de7388d0992e2accf91
Diffstat (limited to 'bootloader.c')
-rw-r--r--bootloader.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/bootloader.c b/bootloader.c
index 7096566..baaddc5 100644
--- a/bootloader.c
+++ b/bootloader.c
@@ -32,6 +32,10 @@ static int set_bootloader_message_block(const struct bootloader_message *in, con
int get_bootloader_message(struct bootloader_message *out) {
Volume* v = volume_for_path("/misc");
+ if (v == NULL) {
+ LOGE("Cannot load volume /misc!\n");
+ return -1;
+ }
if (strcmp(v->fs_type, "mtd") == 0) {
return get_bootloader_message_mtd(out, v);
} else if (strcmp(v->fs_type, "emmc") == 0) {
@@ -43,6 +47,10 @@ int get_bootloader_message(struct bootloader_message *out) {
int set_bootloader_message(const struct bootloader_message *in) {
Volume* v = volume_for_path("/misc");
+ if (v == NULL) {
+ LOGE("Cannot load volume /misc!\n");
+ return -1;
+ }
if (strcmp(v->fs_type, "mtd") == 0) {
return set_bootloader_message_mtd(in, v);
} else if (strcmp(v->fs_type, "emmc") == 0) {