Skip to content

Commit f55270f

Browse files
wyr-7xiaoxiang781216
authored andcommitted
rpmsgfs: fix out of bounds access caused by data transmission farmat
Signed-off-by: Yongrong Wang <[email protected]>
1 parent 94e9599 commit f55270f

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

fs/rpmsgfs/rpmsgfs_client.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,8 +975,24 @@ int rpmsgfs_client_chstat(FAR void *handle, FAR const char *path,
975975

976976
DEBUGASSERT(len <= space);
977977

978-
msg->flags = flags;
979-
memcpy(&msg->buf, buf, sizeof(*buf));
978+
msg->flags = flags;
979+
msg->buf.dev = buf->st_dev;
980+
msg->buf.ino = buf->st_ino;
981+
msg->buf.mode = buf->st_mode;
982+
msg->buf.nlink = buf->st_nlink;
983+
msg->buf.uid = buf->st_uid;
984+
msg->buf.gid = buf->st_gid;
985+
msg->buf.rdev = buf->st_rdev;
986+
msg->buf.size = buf->st_size;
987+
msg->buf.atim_sec = buf->st_atim.tv_sec;
988+
msg->buf.atim_nsec = buf->st_atim.tv_nsec;
989+
msg->buf.mtim_sec = buf->st_mtim.tv_sec;
990+
msg->buf.mtim_nsec = buf->st_mtim.tv_nsec;
991+
msg->buf.ctim_sec = buf->st_ctim.tv_sec;
992+
msg->buf.ctim_nsec = buf->st_ctim.tv_nsec;
993+
msg->buf.blksize = buf->st_blksize;
994+
msg->buf.blocks = buf->st_blocks;
995+
980996
strlcpy(msg->pathname, path, space - sizeof(*msg));
981997

982998
return rpmsgfs_send_recv(priv, RPMSGFS_CHSTAT, false,

0 commit comments

Comments
 (0)