aboutsummaryrefslogtreecommitdiff
path: root/libfdt/fdt_check.c
diff options
context:
space:
mode:
authorPierre-Clément Tosi <ptosi@google.com>2022-07-14 09:38:48 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2022-07-26 21:46:18 +1000
commitfda71da26e7fa00966a58afeb2114269b5512e59 (patch)
tree1ca61f50083ff1fbb2dc7dd86e47b23650801714 /libfdt/fdt_check.c
parentc7c7f17a83d5ec1049ddfcaf22f40fcdc53ac0c4 (diff)
downloaddtc-fda71da26e7fa00966a58afeb2114269b5512e59.zip
dtc-fda71da26e7fa00966a58afeb2114269b5512e59.tar.gz
dtc-fda71da26e7fa00966a58afeb2114269b5512e59.tar.bz2
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 <ptosi@google.com> Message-Id: <20220714083848.958492-1-ptosi@google.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'libfdt/fdt_check.c')
-rw-r--r--libfdt/fdt_check.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libfdt/fdt_check.c b/libfdt/fdt_check.c
index fa410a8..71390ee 100644
--- a/libfdt/fdt_check.c
+++ b/libfdt/fdt_check.c
@@ -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;