diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2021-01-26 00:04:19 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-01-29 10:36:48 -0500 |
commit | 41ac28c67272d99836aebb840e5ab94b3ae14023 (patch) | |
tree | 97590926545d7b743fc912166c0e68899ecb1089 | |
parent | 9c3808debad6cae03850a93af8f3d1a6677ca8c7 (diff) | |
download | u-boot-41ac28c67272d99836aebb840e5ab94b3ae14023.tar.gz u-boot-41ac28c67272d99836aebb840e5ab94b3ae14023.tar.bz2 u-boot-41ac28c67272d99836aebb840e5ab94b3ae14023.zip |
fs: fat: avoid out of bounds access warning
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>
-rw-r--r-- | fs/fat/fat_write.c | 7 |
1 files 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; } |