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>
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 @@
}
}
+ if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) {
+ err_msg = " error!\nCorrupted or truncated tree";
+ goto error;
+ }
+
return 1;
error: