diff options
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r-- | fs/cifs/readdir.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 07838a5ba3a1..4a33add24d53 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -600,7 +600,14 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, | |||
600 | if(unicode) { | 600 | if(unicode) { |
601 | /* BB fixme - test with long names */ | 601 | /* BB fixme - test with long names */ |
602 | /* Note converted filename can be longer than in unicode */ | 602 | /* Note converted filename can be longer than in unicode */ |
603 | pqst->len = cifs_strfromUCS_le((char *)pqst->name,(wchar_t *)filename,len/2,nlt); | 603 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
604 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) | ||
605 | pqst->len = cifs_convertUCSpath((char *)pqst->name, | ||
606 | (__le16 *)filename, len/2, nlt); | ||
607 | else | ||
608 | #endif /* CIFS_EXPERIMENTAL */ | ||
609 | pqst->len = cifs_strfromUCS_le((char *)pqst->name, | ||
610 | (wchar_t *)filename,len/2,nlt); | ||
604 | } else { | 611 | } else { |
605 | pqst->name = filename; | 612 | pqst->name = filename; |
606 | pqst->len = len; | 613 | pqst->len = len; |
@@ -829,7 +836,11 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) | |||
829 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + | 836 | end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + |
830 | smbCalcSize((struct smb_hdr *) | 837 | smbCalcSize((struct smb_hdr *) |
831 | cifsFile->srch_inf.ntwrk_buf_start); | 838 | cifsFile->srch_inf.ntwrk_buf_start); |
832 | tmp_buf = kmalloc(NAME_MAX+1,GFP_KERNEL); | 839 | /* To be safe - for UCS to UTF-8 with strings loaded |
840 | with the rare long characters alloc more to account for | ||
841 | such multibyte target UTF-8 characters. cifs_unicode.c, | ||
842 | which actually does the conversion, has the same limit */ | ||
843 | tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL); | ||
833 | for(i=0;(i<num_to_fill) && (rc == 0);i++) { | 844 | for(i=0;(i<num_to_fill) && (rc == 0);i++) { |
834 | if(current_entry == NULL) { | 845 | if(current_entry == NULL) { |
835 | /* evaluate whether this case is an error */ | 846 | /* evaluate whether this case is an error */ |