浏览代码

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>
Joe Hershberger 12 年之前
父节点
当前提交
367e125976
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      common/image.c

+ 5 - 0
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: