app: aboot: Validate the boot image size
Add check to ensure boot/recovery image size is less
than the partition size.
Change-Id: I63bc64767919ec0e405dcb8959b1310546998332
Signed-off-by: Saranya Chidura <schidura@codeaurora.org>
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index a282275..bb8e77d 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -1635,6 +1635,12 @@
}
#endif
+ /* Validate the boot/recovery image size is within the bounds of partition size */
+ if (imagesize_actual > image_size) {
+ dprintf(CRITICAL, "Image size is greater than partition size.\n");
+ return -1;
+ }
+
#if VERIFIED_BOOT
boot_verifier_init();
#endif