summaryrefslogtreecommitdiff
path: root/common/image.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-08-17 10:34:35 +0000
committerGerald Van Baren <gvb@unssw.com>2012-10-15 19:20:08 -0400
commit367e12597617b2581eb72b3676c6cb86822268b5 (patch)
tree497d009017b24757479355a2894dac2c9abdf350 /common/image.c
parent24fa0e588e68dfb4b15d1e94c543c9301d226902 (diff)
downloadu-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>
Diffstat (limited to 'common/image.c')
-rw-r--r--common/image.c5
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: