diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-30 04:17:21 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-11-30 04:17:21 +0100 |
commit | 21d8a15ac333b05f1fecdf9fdc30996be2e11d60 (patch) | |
tree | 082be97bf4196a0e4ab65300d1c907c12d86aabd /fs/namei.c | |
parent | cifs: get rid of blind d_drop() in readdir (diff) | |
download | linux-21d8a15ac333b05f1fecdf9fdc30996be2e11d60.tar.xz linux-21d8a15ac333b05f1fecdf9fdc30996be2e11d60.zip |
lookup_one_len: don't accept . and ..
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to '')
-rw-r--r-- | fs/namei.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index 937f9d50c84b..5f4cdf3ad913 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -2131,6 +2131,11 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) if (!len) return ERR_PTR(-EACCES); + if (unlikely(name[0] == '.')) { + if (len < 2 || (len == 2 && name[1] == '.')) + return ERR_PTR(-EACCES); + } + while (len--) { c = *(const unsigned char *)name++; if (c == '/' || c == '\0') |