aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorSemen Ustimenko <semenu@FreeBSD.org>2002-10-29 01:03:44 +0000
committerSemen Ustimenko <semenu@FreeBSD.org>2002-10-29 01:03:44 +0000
commite62d4b517b5b4e9b3100bba5eb80514c8e9cd7ae (patch)
tree8f7d393eb5387ef5855a7b5e8fd9840997ca5c31 /sys/fs
parent6e79dd65c34570dbdc2d856ef6df2743a8db1d9d (diff)
downloadsrc-e62d4b517b5b4e9b3100bba5eb80514c8e9cd7ae.tar.gz
src-e62d4b517b5b4e9b3100bba5eb80514c8e9cd7ae.zip
Fix winChkName() to match when the last slot contains nothing but the
terminating zero (it was treated as length missmatch). The mtools create such slots if the name len is the product of 13 (max number of unicode chars fitting in directory slot). MFC after: 1 week
Notes
Notes: svn path=/head/; revision=106110
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/msdosfs/msdosfs_conv.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c
index 32138c51b6f5..7b3591e57666 100644
--- a/sys/fs/msdosfs/msdosfs_conv.c
+++ b/sys/fs/msdosfs/msdosfs_conv.c
@@ -780,7 +780,14 @@ winChkName(un, unlen, wep, chksum, u2w_loaded, u2w, ul_loaded, ul)
*/
i = ((wep->weCnt&WIN_CNT) - 1) * WIN_CHARS;
un += i;
- if ((unlen -= i) <= 0)
+ unlen -= i;
+
+ /*
+ * unlen being zero must not be treated as length missmatch. It is
+ * possible if the entry is WIN_LAST and contains nothing but the
+ * terminating 0.
+ */
+ if (unlen < 0)
return -1;
if ((wep->weCnt&WIN_LAST) && unlen > WIN_CHARS)
return -1;