提交 41ac28c6 编写于 作者: H Heinrich Schuchardt 提交者: Tom Rini

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: NHeinrich Schuchardt <xypron.glpk@gmx.de>
上级 9c3808de
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册