From: Al Viro Date: Fri, 6 Sep 2013 20:55:36 +0000 (-0400) Subject: exportfs: don't assume that ->iterate() won't feed us too long entries X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=dfc59e2c90f780653e7b0b749c2a547a9bb1b2ce;p=deliverable%2Flinux.git exportfs: don't assume that ->iterate() won't feed us too long entries On some filesystems it's impossible even with fs corruption, but we'd better not rely on that, what with memcpy() into on-stack array we are doing there. Signed-off-by: Al Viro --- diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 293bc2e47a73..a235f0016889 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c @@ -231,7 +231,7 @@ static int filldir_one(void * __buf, const char * name, int len, int result = 0; buf->sequence++; - if (buf->ino == ino) { + if (buf->ino == ino && len <= NAME_MAX) { memcpy(buf->name, name, len); buf->name[len] = '\0'; buf->found = 1;