Skip to content

Commit

Permalink
lookup_one_len: don't accept . and ..
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Nov 30, 2012
1 parent 0903a0c commit 21d8a15
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 21d8a15

Please sign in to comment.