libfdt: fdt_path_offset_namelen: Reject empty paths am: d10c84c4bc am: 9f4834b735 am: e0440b0907 am: 13d00fad64 am: 7799b9fb26 am: 98ab028002 am: 0a053dfe49 am: 1716041baa am: daba1986c0

Original change: https://googleplex-android-review.googlesource.com/c/platform/external/dtc/+/20024811

Change-Id: Id4bdb7dbb7bc04d4459313fdcda2fb9bec80ff6f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index e61df25..87d736b 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -258,6 +258,9 @@
 	if (namelen < 1)
 		return -FDT_ERR_BADPATH;
 
+	if (namelen < 1)
+		return -FDT_ERR_BADPATH;
+
 	/* see if we have an alias */
 	if (*path != '/') {
 		const char *q = memchr(path, '/', end - p);