[PATCH] CIFS: Fix missing entries in search results
authorSteve French <smfrench@austin.rr.com>
Sun, 14 Aug 2005 21:55:23 +0000 (16:55 -0500)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sun, 14 Aug 2005 22:27:24 +0000 (15:27 -0700)
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)
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/cifs/cifssmb.c

index 3c628bf667a5f010ff17c14d2ffc04f499d80c7d..0db0b313d7150f49795c0cc2a765d1abe298f0b0 100644 (file)
@@ -2602,6 +2602,9 @@ int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
        if(name_len < PATH_MAX) {
                memcpy(pSMB->ResumeFileName, psrch_inf->presume_name, 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 {
                rc = -EINVAL;
                goto FNext2_err_exit;