commit | 21d8a15ac333b05f1fecdf9fdc30996be2e11d60 | [log] [tgz] |
---|---|---|
author | Al Viro <viro@zeniv.linux.org.uk> | Thu Nov 29 22:17:21 2012 -0500 |
committer | Al Viro <viro@zeniv.linux.org.uk> | Thu Nov 29 22:17:21 2012 -0500 |
tree | 082be97bf4196a0e4ab65300d1c907c12d86aabd | |
parent | 0903a0c8491c1e987dfc6eb294199a36760398bc [diff] [blame] |
lookup_one_len: don't accept . and .. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
diff --git a/fs/namei.c b/fs/namei.c index 937f9d5..5f4cdf3 100644 --- a/fs/namei.c +++ b/fs/namei.c
@@ -2131,6 +2131,11 @@ 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')