提交 2a3be302 编写于 作者: P Philippe Reynes 提交者: Simon Glass

lib: libfdt: fdt_region: avoid NULL pointer access

The function fdt_find_regions look in the exclude list for each
property, even if the name is NULL. It could happen if the fit
image is corrupted. On sandbox, it generates a segfault.

To avoid this issue, if the name of a property is NULL, we report
an error and avoid looking in the exclude list.
Signed-off-by: NPhilippe Reynes <philippe.reynes@softathome.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 df1fa4b2
......@@ -65,6 +65,8 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count,
stop_at = offset;
prop = fdt_get_property_by_offset(fdt, offset, NULL);
str = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
if (!str)
return -FDT_ERR_BADSTRUCTURE;
if (str_in_list(str, exc_prop, exc_prop_count))
include = 0;
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册