From: David Gibson <david-xT8FGy+AXnRB3Ne2BGzF6laj5H9X9Tb+@public.gmane.org>
To: "Pierre-Clément Tosi" <ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Jon Loeliger <loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] libfdt: Handle failed get_name() on BEGIN_NODE
Date: Tue, 26 Jul 2022 21:47:21 +1000 [thread overview]
Message-ID: <Yt/USZcIc7FHBQsi@yekko> (raw)
In-Reply-To: <20220714083848.958492-1-ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
[-- 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 --]
prev parent reply other threads:[~2022-07-26 11:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Yt/USZcIc7FHBQsi@yekko \
--to=david-xt8fgy+axnrb3ne2bgzf6laj5h9x9tb+@public.gmane.org \
--cc=devicetree-compiler-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=loeliger-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ptosi-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).