The fname->name is based64_encoded names and the max long shouldn't
exceed the NAME_MAX.
The FSCRYPT_BASE64URL_CHARS(NAME_MAX) will be 255 * 4 / 3.
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
}
/* Sanity check that the resulting name will fit in the buffer */
- if (fname->name_len > FSCRYPT_BASE64URL_CHARS(NAME_MAX))
+ if (fname->name_len > NAME_MAX || fname->ctext_len > NAME_MAX)
return -EIO;
ret = __fscrypt_prepare_readdir(fname->dir);