All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs: fat: avoid out of bounds access warning
@ 2021-01-25 23:04 Heinrich Schuchardt
  2021-01-30 19:21 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Heinrich Schuchardt @ 2021-01-25 23:04 UTC (permalink / raw)
  To: u-boot

When copying short name plus extension refer to the encapsulating structure
and not to the short name element.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 fs/fat/fat_write.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 0132ef9b42..aae3a6a3d1 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -108,10 +108,7 @@ static int set_name(fat_itr *itr, const char *filename, char *shortname)
 	char buf[13];
 	int i;
 	int ret;
-	struct {
-		char name[8];
-		char ext[3];
-	} dirent;
+	struct nameext dirent;

 	if (!filename)
 		return -EIO;
@@ -185,7 +182,7 @@ static int set_name(fat_itr *itr, const char *filename, char *shortname)
 	}
 	return -EIO;
 out:
-	memcpy(shortname, dirent.name, SHORT_NAME_SIZE);
+	memcpy(shortname, &dirent, SHORT_NAME_SIZE);
 	return ret;
 }

--
2.29.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 1/1] fs: fat: avoid out of bounds access warning
  2021-01-25 23:04 [PATCH 1/1] fs: fat: avoid out of bounds access warning Heinrich Schuchardt
@ 2021-01-30 19:21 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2021-01-30 19:21 UTC (permalink / raw)
  To: u-boot

On Tue, Jan 26, 2021 at 12:04:19AM +0100, Heinrich Schuchardt wrote:

> When copying short name plus extension refer to the encapsulating structure
> and not to the short name element.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210130/2fd53893/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-30 19:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 23:04 [PATCH 1/1] fs: fat: avoid out of bounds access warning Heinrich Schuchardt
2021-01-30 19:21 ` Tom Rini

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.