[automerge] libfdt: fdt_path_offset_namelen: Reject empty paths 2p: a6ac6d916d

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

Bug: 246465319
Change-Id: I0ca57afacace494e41bb33cde3181437662e3547
diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c
index e03570a..7a65dfe 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -253,6 +253,9 @@
 
 	FDT_RO_PROBE(fdt);
 
+	if (namelen < 1)
+		return -FDT_ERR_BADPATH;
+
 	/* see if we have an alias */
 	if (*path != '/') {
 		const char *q = memchr(path, '/', end - p);