* [PATCH] libfdt: Handle failed get_name() on BEGIN_NODE
@ 2022-07-14 8:38 Pierre-Clément Tosi
[not found] ` <20220714083848.958492-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Clément Tosi @ 2022-07-14 8:38 UTC (permalink / raw)
To: David Gibson, Jon Loeliger
Cc: Pierre-Clément Tosi,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
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.
fixes: a2def5479950 ("libfdt: Check that the root-node name is empty")
Signed-off-by: Pierre-Clément Tosi <ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
---
libfdt/fdt_check.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.37.0.170.g444d1eabd0-goog
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libfdt: Handle failed get_name() on BEGIN_NODE
[not found] ` <20220714083848.958492-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
@ 2022-07-26 11:47 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2022-07-26 11:47 UTC (permalink / raw)
To: Pierre-Clément Tosi
Cc: Jon Loeliger, devicetree-compiler-u79uwXL29TY76Z2rM5mHXA
[-- Attachment #1: Type: text/plain, Size: 1141 bytes --]
On Thu, Jul 14, 2022 at 09:38:48AM +0100, Pierre-Clément Tosi wrote:
> 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.
>
> fixes: a2def5479950 ("libfdt: Check that the root-node name is empty")
> Signed-off-by: Pierre-Clément Tosi <ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Applied, thanks. Sorry it took me so long to look at this.
> ---
> libfdt/fdt_check.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-07-26 11:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-14 8:38 [PATCH] libfdt: Handle failed get_name() on BEGIN_NODE Pierre-Clément Tosi
[not found] ` <20220714083848.958492-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2022-07-26 11:47 ` David Gibson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).