All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Goodbody <andrew.goodbody@linaro.org>
To: Martin Husemann <martin@NetBSD.org>
Cc: Tom Rini <trini@konsulko.com>, u-boot@lists.denx.de
Subject: Re: [PATCH] fs: fat: Prevent possible buffer overflow
Date: Thu, 17 Jul 2025 16:38:50 +0100	[thread overview]
Message-ID: <1e80ff96-48a5-4a17-85df-59c8459b3083@linaro.org> (raw)
In-Reply-To: <20250717145858.GB20410@mail.duskware.de>

On 17/07/2025 15:58, Martin Husemann wrote:
> On Thu, Jul 17, 2025 at 03:54:37PM +0100, Andrew Goodbody wrote:
>>   
>>   	memset(dent, 0, sizeof(*dent));
>> -	strcpy(dent->name, dir->itr.name);
>> +	strlcpy(dent->name, dir->itr.name, FS_DIRENT_NAME_LEN);
> 
> Shouldn't that be strncpy() instead? Using strlcpy() for fixed size
> records where strings may not be \0 terminated is quirky.
> 
> Martin

Hi Martin,

The original use of strcpy suggests that the string must be \0 
terminated. I will admit that I do not know the code well, is 
dir->itr.name guaranteed to be a known fixed size?

Andrew

  reply	other threads:[~2025-07-17 15:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-17 14:54 [PATCH] fs: fat: Prevent possible buffer overflow Andrew Goodbody
2025-07-17 14:58 ` Martin Husemann
2025-07-17 15:38   ` Andrew Goodbody [this message]
2025-07-17 16:57     ` Martin Husemann
2025-07-18  9:17       ` Andrew Goodbody

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=1e80ff96-48a5-4a17-85df-59c8459b3083@linaro.org \
    --to=andrew.goodbody@linaro.org \
    --cc=martin@NetBSD.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.