Commit fe14535e authored by Marek Vasut's avatar Marek Vasut

mxssb: Add file alignment check

If the file we try to verify is not aligned, it doesn't follow the
specification and is therefore corrupted. Check this condition early
in the process.
Signed-off-by: Marek Vasut's avatarMarek Vasut <marex@denx.de>
parent 44e32f6e
......@@ -1758,6 +1758,11 @@ static int sb_build_tree_from_img(struct sb_image_ctx *ictx)
goto err_file;
}
if (filesize & (SB_BLOCK_SIZE - 1)) {
fprintf(stderr, "ERR: The file is not aligned!\n");
goto err_file;
}
/* Load and verify image header */
ret = sb_verify_image_header(ictx, fp, filesize);
if (ret)
......
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