app: aboot: zero out extra bits, while update misc partition.
Zeored out extra bits while updating misc parition.
Change-Id: I9f57a78b00360b7ee464cd0c76540de8d9784555
diff --git a/app/aboot/recovery.c b/app/aboot/recovery.c
index 49f5057..cecfb27 100644
--- a/app/aboot/recovery.c
+++ b/app/aboot/recovery.c
@@ -527,6 +527,11 @@
return -1;
}
+ /* This will ensure, we zeored out any extra bytes
+ we will push to emmc, to prevent information leak */
+ if (aligned_size > size)
+ memset((scratch_addr + size), 0, (aligned_size-size));
+
if (scratch_addr != buf)
memcpy(scratch_addr, buf, size);
@@ -568,8 +573,14 @@
return -1;
}
+ /* This will ensure, we zeored out any extra bytes
+ we will push, to prevent information leak */
+ if (aligned_size > size)
+ memset((scratch_addr + size), 0, (aligned_size-size));
+
if (scratch_addr != buf)
memcpy(scratch_addr, buf, size);
+
if (flash_write(ptn, offset, scratch_addr, aligned_size)) {
dprintf(CRITICAL, "Writing flash failed\n");
return -1;