Commit 7b0c8fcf authored by Suresh Jayaraman's avatar Suresh Jayaraman Committed by Steve French

cifs: Increase size of tmp_buf in cifs_readdir to avoid potential overflows

Increase size of tmp_buf to possible maximum to avoid potential
overflows.
Pointed-out-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSuresh Jayaraman <sjayaraman@suse.de>
Acked-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 968460eb
...@@ -1074,7 +1074,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) ...@@ -1074,7 +1074,7 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
with the rare long characters alloc more to account for with the rare long characters alloc more to account for
such multibyte target UTF-8 characters. cifs_unicode.c, such multibyte target UTF-8 characters. cifs_unicode.c,
which actually does the conversion, has the same limit */ which actually does the conversion, has the same limit */
tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL); tmp_buf = kmalloc((4 * NAME_MAX) + 2, GFP_KERNEL);
for (i = 0; (i < num_to_fill) && (rc == 0); i++) { for (i = 0; (i < num_to_fill) && (rc == 0); i++) {
if (current_entry == NULL) { if (current_entry == NULL) {
/* evaluate whether this case is an error */ /* evaluate whether this case is an error */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment