From 8f7162cbd9ef4339bec21fd7c82645a5919191a3 Mon Sep 17 00:00:00 2001 From: semenu Date: Tue, 29 Oct 2002 01:03:44 +0000 Subject: 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 --- sys/fs/msdosfs/msdosfs_conv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/fs/msdosfs') diff --git a/sys/fs/msdosfs/msdosfs_conv.c b/sys/fs/msdosfs/msdosfs_conv.c index 32138c5..7b3591e 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; -- cgit v1.1