[automerge] libfdt: fdt_path_offset_namelen: Reject empty paths 2p: a6ac6d916d 2p: c69e9730e6 am: 5b78ca8410

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

Change-Id: I29a121003addfe5db9fd8d24a7f05eaa0403b06e
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 9f6c551..e61df25 100644
--- a/libfdt/fdt_ro.c
+++ b/libfdt/fdt_ro.c
@@ -255,6 +255,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);