dtc: add integer overflow checks in fdt header

Protect against integer overflows caused by malformed fdt headers.

[eberman@codeaurora.org: most of changes have been fixed in 
commit f858927fd6 ("scripts/dtc: Update to upstream version
v1.4.7-14-gc86da84d30e4"). The upstream was commit eb890c0f77dc
("libfdt: Make fdt_check_header() more thorough"))]
CRs-Fixed: 749977
Change-Id: I51d87038f520bc761b163d291b0138c513c69a33
Signed-off-by: Vijay Kumar Pendoti <vpendo@codeaurora.org>
Signed-off-by: Elliot Berman <eberman@codeaurora.org>
This commit is contained in:
Vijay Kumar Pendoti 2014-08-12 20:35:44 +05:30 committed by Elliot Berman
parent e99d705509
commit ef95f6c3b1

View File

@ -407,7 +407,7 @@ int fdt_del_node(void *fdt, int nodeoffset)
static void fdt_packblocks_(const char *old, char *new,
int mem_rsv_size, int struct_size)
{
int mem_rsv_off, struct_off, strings_off;
uint32_t mem_rsv_off, struct_off, strings_off;
mem_rsv_off = FDT_ALIGN(sizeof(struct fdt_header), 8);
struct_off = mem_rsv_off + mem_rsv_size;