From: E Shattow <e@freeshell.de>
To: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>,
Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>,
Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>,
Sam Edwards <cfsworks@gmail.com>, Anshul Dalal <anshuld@ti.com>,
u-boot@lists.denx.de
Subject: Re: [PATCH 1/2] common/spl: Revert fix potential out of buffer access in spl_fit_get_image_name function
Date: Tue, 24 Jun 2025 19:18:20 -0700 [thread overview]
Message-ID: <824349e2-ada2-4859-a8cf-9f997d0fffd7@freeshell.de> (raw)
In-Reply-To: <20250624153431.46986-2-heinrich.schuchardt@canonical.com>
On 6/24/25 08:34, Heinrich Schuchardt wrote:
> The change in commit 3704b888a4ca ("common/spl: fix potential out of buffer
> access in spl_fit_get_image_name function") led to function
> spl_fit_get_image_name() no longer detecting if a property does not exist
> at a non-zero buffer.
>
> Link: https://lore.kernel.org/u-boot/38f5d078-3328-4bdb-9c95-4fb5fe89ddc2@gmx.de/T/#m59f3a23e675daa992c28d12236de71cae2ca2bb9
> Fixes: 3704b888a4ca ("common/spl: fix potential out of buffer access in spl_fit_get_image_name function")
> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
> ---
> common/spl/spl_fit.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
> index b3824af475f..e250c11ebbd 100644
> --- a/common/spl/spl_fit.c
> +++ b/common/spl/spl_fit.c
> @@ -86,12 +86,11 @@ static int spl_fit_get_image_name(const struct spl_fit_info *ctx,
>
> str = name;
> for (i = 0; i < index; i++) {
> - str = memchr(str, '\0', name + len - str);
> - if (!str) {
> + str = strchr(str, '\0') + 1;
> + if (!str || (str - name >= len)) {
> found = false;
> break;
> }
> - str++;
> }
>
> if (!found && CONFIG_IS_ENABLED(SYSINFO) && !sysinfo_get(&sysinfo)) {
Tested-by: E Shattow <e@freeshell.de>
next prev parent reply other threads:[~2025-06-25 2:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-24 15:34 [PATCH 0/2] spl: fix error handling in spl_fit_get_image_name() Heinrich Schuchardt
2025-06-24 15:34 ` [PATCH 1/2] common/spl: Revert fix potential out of buffer access in spl_fit_get_image_name function Heinrich Schuchardt
2025-06-25 2:18 ` E Shattow [this message]
2025-06-24 15:34 ` [PATCH 2/2] common/spl: guard against buffer overflow in spl_fit_get_image_name() Heinrich Schuchardt
2025-06-24 21:02 ` Mikhail Kshevetskiy
2025-06-24 23:05 ` Heinrich Schuchardt
2025-06-24 21:05 ` Mikhail Kshevetskiy
2025-06-24 23:05 ` Heinrich Schuchardt
2025-06-24 23:07 ` Mikhail Kshevetskiy
2025-06-25 2:18 ` E Shattow
2025-06-25 2:00 ` [PATCH 0/2] spl: fix error handling " E Shattow
2025-06-26 19:32 ` Tom Rini
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=824349e2-ada2-4859-a8cf-9f997d0fffd7@freeshell.de \
--to=e@freeshell.de \
--cc=anshuld@ti.com \
--cc=cfsworks@gmail.com \
--cc=heinrich.schuchardt@canonical.com \
--cc=mikhail.kshevetskiy@iopsys.eu \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/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