mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
tools: kwboot: Explicitly check against size of struct main_hdr_v1
Explicitly check the image size against size of struct main_hdr_v1. This way the check is more readable, since the `hdrsz` variable may semantically contain another value. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
This commit is contained in:
parent
04ced0296e
commit
5c8f812ca9
1 changed files with 2 additions and 2 deletions
|
@ -820,14 +820,14 @@ kwboot_img_patch_hdr(void *img, size_t *size)
|
|||
struct main_hdr_v1 *hdr;
|
||||
uint32_t srcaddr;
|
||||
uint8_t csum;
|
||||
size_t hdrsz = sizeof(*hdr);
|
||||
size_t hdrsz;
|
||||
int image_ver;
|
||||
int is_secure;
|
||||
|
||||
rc = -1;
|
||||
hdr = img;
|
||||
|
||||
if (*size < hdrsz) {
|
||||
if (*size < sizeof(struct main_hdr_v1)) {
|
||||
errno = EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue