summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Pierre-Clément Tosi <ptosi@google.com> 2022-07-14 09:38:48 +0100
committer Pierre-Clément Tosi <ptosi@google.com> 2022-07-29 12:10:55 +0100
commitc0a4830d8dc889eda299524f9dad159c0fc70745 (patch)
tree7df4719c9b6c5b144fb2e5b98a45f5238ab0f21e
parent200bb7ae519d1066e4d22bf4f675e9273c87eff4 (diff)
FROMGIT: 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. Bug: 238913758 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> Change-Id: Iab533f4f5cbe041fa1e6baad25acf6a859bbee53
-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;