From d533df07c20c7b59b0559a3ac38fb45c81ffd6bb Mon Sep 17 00:00:00 2001 From: Namjae Jeon Date: Fri, 23 Mar 2012 15:02:39 -0700 Subject: fat: fix bug in enforcing Long File Name length Since '*outlen' is initialized to zero, it is currently possible to create a filename of length (FAT_LFN_LEN + 1) when utf8 is not enabled. To enforce the FAT_LFN_LEN limit, we must perform one less iteration. Signed-off-by: Namjae Jeon Signed-off-by: Ravishankar N Acked-by: OGAWA Hirofumi Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/fat/namei_vfat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/fat/namei_vfat.c') diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index aae3b4e1057d..98ae804f5273 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c @@ -522,7 +522,7 @@ xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, op = &outname[*outlen * sizeof(wchar_t)]; } else { for (i = 0, ip = name, op = outname, *outlen = 0; - i < len && *outlen <= FAT_LFN_LEN; + i < len && *outlen < FAT_LFN_LEN; *outlen += 1) { if (escape && (*ip == ':')) { if (i > len - 5) -- cgit v1.2.3