[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

msdosfs long name lookup error



Description:
        In msdosfs file systems, there exists a problem when looking up
        long file names with similar names.  If the file name being looked
        up matches the beginning 13 (or n*13) characters of an existing
file,
        it will return a match.  This occurs because the function
'winChkName'
        does not check if the file name is longer than it can check.

>How-To-Repeat:
        cd /msdos
        md 'd1d2d3d4d5d6d7d8d9d10d11d12d13d14d15d16'          #Note: long
name
        ls
	d1d2d3d4d5d6d7d8d9d10d11d12d13d14d15d16


        md 'd1d2d3d4d5d6d7d8d9d10d11d12d13d14d15d16d17'  #Note: 3 character
longer
        rm : The dir is exist.

>Fix:
	Check the length befor check name.
>>
cvs -z9 update -p -D yesterday msdosfs_conv.c (in directory
F:\OpenBSD\src\sys\msdosfs\)
===================================================================
Checking out msdosfs_conv.c
RCS:  /cvs/src/sys/msdosfs/msdosfs_conv.c,v
VERS: 1.10
***************

***** CVS exited normally with code 0 *****

cvs -z9 diff msdosfs_conv.c (in directory F:\OpenBSD\src\sys\msdosfs\)
Index: msdosfs_conv.c
===================================================================
RCS file: /cvs/src/sys/msdosfs/msdosfs_conv.c,v
retrieving revision 1.10
diff -r1.10 msdosfs_conv.c


      643c643,646
< 	if (wep->weCnt&WIN_LAST)
---
> 	if (wep->weCnt&WIN_LAST) {
>         if (unlen > ((wep->weCnt & WIN_CNT) * WIN_CHARS)) {
>             return -1;
>         }
644a648
> 	}
649c653
<