libfdt: Handle failed get_name() on BEGIN_NODE
PATCH 1/1 libfdt: Handle failed get_name() on BEGIN_NODE
Validate the return value of fdt_get_name() as an ill-formed DT, causing it to fail, could result in fdt_check_full() dereferencing NULL.
Fixes a2def5479950 ("libfdt: Check that the root-node name is empty")
Signed-off-by Pierre-Clément Tosi <[email protected]>
--- libfdt/fdt_check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libfdt/fdt_check.c +1 -1
@@ -66,7 +66,7 @@ int fdt_check_full(const void *fdt, size_t bufsize)int len; name =fdt_get_name (fdt, offset, &len); -if (*name || len) +if (!name || *name || len)return -FDT_ERR_BADSTRUCTURE ; }break ;
Signature · 1 line
2.37.0.170.g444d1eabd0-goog
A message that is not in the archive (sent off-list or not yet received): 20220714083848.958492-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org
David Gibson
AppliedQuoted 5 lines · Pierre-Clément Tosi
Validate the return value of
fdt_get_name()as an ill-formed DT, causing it to fail, could result infdt_check_full()dereferencing NULL.Fixes a2def5479950 ("libfdt: Check that the root-node name is empty")Signed-off-by Pierre-Clément Tosi <[email protected]>
Applied, thanks. Sorry it took me so long to look at this.
Quoted 17 lines
--- libfdt/fdt_check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libfdt/fdt_check.c +1
-1@@ -66,7 +66,7 @@ int fdt_check_full(const void *fdt, size_t bufsize)int len; name =fdt_get_name (fdt, offset, &len); -if (*name || len) +if (!name || *name || len)return -FDT_ERR_BADSTRUCTURE ; }break ;
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson