recovery: Fix potential dprintf issue
Terminate recovery message command string before actually printing it
Change-Id: Iea5e7dd27a88e65f2cf5ac9a87c29a0f85b55260
diff --git a/app/aboot/recovery.c b/app/aboot/recovery.c
index fc14a7f..53d894e 100644
--- a/app/aboot/recovery.c
+++ b/app/aboot/recovery.c
@@ -295,10 +295,11 @@
// get recovery message
if (get_recovery_message(&msg))
return -1;
- if (msg.command[0] != 0 && msg.command[0] != 255) {
- dprintf(INFO, "Recovery command: %.*s\n", sizeof(msg.command), msg.command);
- }
msg.command[sizeof(msg.command)-1] = '\0'; //Ensure termination
+ if (msg.command[0] != 0 && msg.command[0] != 255) {
+ dprintf(INFO,"Recovery command: %d %s\n",
+ sizeof(msg.command), msg.command);
+ }
if (!strcmp("boot-recovery",msg.command))
{
@@ -429,10 +430,11 @@
// get recovery message
if(emmc_get_recovery_msg(&msg))
return -1;
- if (msg.command[0] != 0 && msg.command[0] != 255) {
- dprintf(INFO,"Recovery command: %d %s\n", sizeof(msg.command), msg.command);
- }
msg.command[sizeof(msg.command)-1] = '\0'; //Ensure termination
+ if (msg.command[0] != 0 && msg.command[0] != 255) {
+ dprintf(INFO,"Recovery command: %d %s\n",
+ sizeof(msg.command), msg.command);
+ }
if (!strcmp("update-radio",msg.command))
{