diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index eefeaa721b9d..d63e4a583413 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c @@ -204,7 +204,7 @@ int ceph_fname_to_usr(const struct ceph_fname *fname, struct fscrypt_str *tname, } /* 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);