diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2012-08-17 10:34:35 +0000 |
---|---|---|
committer | Gerald Van Baren <gvb@unssw.com> | 2012-10-15 19:20:08 -0400 |
commit | 367e12597617b2581eb72b3676c6cb86822268b5 (patch) | |
tree | 497d009017b24757479355a2894dac2c9abdf350 | |
parent | 24fa0e588e68dfb4b15d1e94c543c9301d226902 (diff) | |
download | u-boot-imx-367e12597617b2581eb72b3676c6cb86822268b5.zip u-boot-imx-367e12597617b2581eb72b3676c6cb86822268b5.tar.gz u-boot-imx-367e12597617b2581eb72b3676c6cb86822268b5.tar.bz2 |
fdt: Check error codes returned from fdtlib when loading ITB
Before this patch, error codes returned from fdtlib were ignored and
continued access would cause a crash. Now just check if the image is
truncated and error if so.
Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
-rw-r--r-- | common/image.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/common/image.c b/common/image.c index f084d2b..852a96f 100644 --- a/common/image.c +++ b/common/image.c @@ -2820,6 +2820,11 @@ int fit_image_check_hashes(const void *fit, int image_noffset) } } + if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) { + err_msg = " error!\nCorrupted or truncated tree"; + goto error; + } + return 1; error: |