You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2022/04/08 12:06:46 UTC
[incubator-nuttx] branch master updated: fs/vfs: fix st_mode mask check
This is an automated email from the ASF dual-hosted git repository.
pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 4b6743591a fs/vfs: fix st_mode mask check
4b6743591a is described below
commit 4b6743591a524aeb00a263d9e4b37ad0c5451d90
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Fri Apr 8 12:06:17 2022 +0800
fs/vfs: fix st_mode mask check
The full mask for st_mode is 0177777
Now modify any file permissions in hostfs and all will fail
---
fs/vfs/fs_chstat.c | 2 +-
fs/vfs/fs_fchstat.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/vfs/fs_chstat.c b/fs/vfs/fs_chstat.c
index 93c4db7e60..38c0fb44f8 100644
--- a/fs/vfs/fs_chstat.c
+++ b/fs/vfs/fs_chstat.c
@@ -118,7 +118,7 @@ static int chstat(FAR const char *path,
/* Adjust and check buf and flags */
- if ((flags & CH_STAT_MODE) && (buf->st_mode & ~07777))
+ if ((flags & CH_STAT_MODE) && (buf->st_mode & ~0177777))
{
goto errout;
}
diff --git a/fs/vfs/fs_fchstat.c b/fs/vfs/fs_fchstat.c
index df9a6b87d1..44d8306988 100644
--- a/fs/vfs/fs_fchstat.c
+++ b/fs/vfs/fs_fchstat.c
@@ -112,7 +112,7 @@ int file_fchstat(FAR struct file *filep, FAR struct stat *buf, int flags)
/* Adjust and check buf and flags */
- if ((flags & CH_STAT_MODE) && (buf->st_mode & ~07777))
+ if ((flags & CH_STAT_MODE) && (buf->st_mode & ~0177777))
{
return -EINVAL;
}