app: aboot: Add check to prevent OOB read while parsing cmd_flash_meta_img

Add check to confirm the size of given image which unchecked may cause OOB
error while flashing meta images.

Change-Id: I74307c9c64694bf7336ba9a2317fb0a376222e89
Signed-off-by: Ashish Bhimanpalliwar <abhiman@codeaurora.org>
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 51bdf85..d2b04fd 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2019, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2009-2020, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -3811,7 +3811,7 @@
 #endif
 
 	meta_header = (meta_header_t*) data;
-	if( data_end < ((uintptr_t)data + meta_header->img_hdr_sz))
+	if( data_end < ((uintptr_t)data + sizeof(meta_header_t)  + meta_header->img_hdr_sz))
 	{
 		fastboot_fail("Cannot  flash: image header corrupt");
 		return;