Commit 835c30e368e9661a6d99179d948f64efebf5d1de
Committed by
Stefano Babic
1 parent
7daaac5281
Exists in
v2017.01-smarct4x
and in
30 other branches
imximage: header.length of 4 is valid
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
tools/imximage.c
... | ... | @@ -361,8 +361,8 @@ |
361 | 361 | dcd_v2_t *dcd_v2 = &hdr_v2->dcd_table; |
362 | 362 | uint32_t size, version; |
363 | 363 | |
364 | - size = be16_to_cpu(dcd_v2->header.length) - 8; | |
365 | - if (size > (MAX_HW_CFG_SIZE_V2 * sizeof(dcd_addr_data_t))) { | |
364 | + size = be16_to_cpu(dcd_v2->header.length); | |
365 | + if (size > (MAX_HW_CFG_SIZE_V2 * sizeof(dcd_addr_data_t)) + 8) { | |
366 | 366 | fprintf(stderr, |
367 | 367 | "Error: Image corrupt DCD size %d exceed maximum %d\n", |
368 | 368 | (uint32_t)(size / sizeof(dcd_addr_data_t)), |