瀏覽代碼

[CIFS] Fix missing entries in search results when very long file names and
more than 50 (or so) of such long search entries in the directory. FindNext
could send corrupt last byte of resume name when resume key was a few hundred
bytes long file name or longer.

Fixes Samba Bug # 2932

Signed-off-by: Steve French (sfrench@us.ibm.com)

Steve French 20 年之前
父節點
當前提交
ef6724e321
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      fs/cifs/cifssmb.c

+ 3 - 0
fs/cifs/cifssmb.c

@@ -2628,6 +2628,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
 	if(name_len < PATH_MAX) {
 	if(name_len < PATH_MAX) {
 		memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len);
 		memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, name_len);
 		byte_count += name_len;
 		byte_count += name_len;
+		/* 14 byte parm len above enough for 2 byte null terminator */
+		pSMB->ResumeFileName[name_len] = 0;
+		pSMB->ResumeFileName[name_len+1] = 0;
 	} else {
 	} else {
 		rc = -EINVAL;
 		rc = -EINVAL;
 		goto FNext2_err_exit;
 		goto FNext2_err_exit;