Commit 95d8b123 authored by Ye Li's avatar Ye Li

MLK-20239-4 imx8qm/qxp: Fix untrust array index

Fix coverity issue CID 3303250: Untrusted array index read (TAINTED_SCALAR)
tainted_data: Using tainted variable header.num_images - 1 as an index into
an array header.img
Signed-off-by: default avatarYe Li <ye.li@nxp.com>
parent d1583963
......@@ -518,6 +518,8 @@ int get_container_image_start_pos(image_t *image_stack, uint32_t align)
if (header.tag != IVT_HEADER_TAG_B0) {
printf("header tag missmatched \n");
} else if (header.num_images == 0) {
printf("image num is 0 \n");
} else {
file_off += header.img[header.num_images - 1].size;
file_off = ALIGN(file_off, align);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment