app: aboot: add check for possible NULL dereference.
Fix for possible NULL derefernce.
Change-Id: I67ad17c18297a6373c471a7f5afc1acbce7f773a
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 83a2c49..18ecf8b 100755
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -3581,7 +3581,7 @@
if (arg)
{
p = strtok_r((char *)arg, ":", &sp);
- if (*p)
+ if (p)
{
current_active_slot = partition_find_active_slot();
@@ -3590,7 +3590,8 @@
current_slot_suffix = strtok_r((char *)current_slot_suffix,
(char *)suffix_delimiter, &sp);
- if (!strncmp(p, current_slot_suffix, sizeof(current_slot_suffix)))
+ if (current_slot_suffix &&
+ !strncmp(p, current_slot_suffix, strlen(current_slot_suffix)))
{
fastboot_okay("Slot already set active");
return;
@@ -3602,7 +3603,8 @@
current_slot_suffix = SUFFIX_SLOT(i);
current_slot_suffix = strtok_r((char *)current_slot_suffix,
(char *)suffix_delimiter, &sp);
- if (!strncmp(p, current_slot_suffix, sizeof(current_slot_suffix)))
+ if (current_slot_suffix &&
+ !strncmp(p, current_slot_suffix, strlen(current_slot_suffix)))
{
partition_switch_slots(current_active_slot, i);
publish_getvar_multislot_vars();