diff --git a/libfdt/fdt_ro.c b/libfdt/fdt_ro.c index 9f6c551..87d736b 100644 --- a/libfdt/fdt_ro.c +++ b/libfdt/fdt_ro.c @@ -255,6 +255,12 @@ int fdt_path_offset_namelen(const void *fdt, const char *path, int namelen) FDT_RO_PROBE(fdt); + 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);