Skip to contentSkip to conversation

fat: Fix bug in enforcing Long File Name length.

PATCH In review Namjae Jeon 2 participants 4 messages Mar 3, 2012 – Mar 4, 2012 VFAT/FAT/msdos filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 fat: Fix bug in enforcing Long File Name length.

Since '*outlen' is initialized to zero,it is currently possible to create a f ilename of length (FAT_LFN_LEN +1) when utf8 is not enabled.To enforce the FA T_LFN_LEN limit, we must perform one less iteration.

---
 fs/fat/namei_vfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fat/namei_vfat.c +1 -1
index aae3b4e..98ae804 100644
@@ -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)
Signature · 1 line
1.7.5.4
maintainer Acked-by on v1 2/2
#1 lore raw
Quoted 1 line · Namjae Jeon

Since '*outlen' is initialized to zero,it is currently possible to create a f ilename of length (FAT_LFN_LEN +1) when utf8 is not enabled.To enforce the FA T_LFN_LEN limit, we must perform one less iteration.

Quoted 19 lines
---
 fs/fat/namei_vfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fat/namei_vfat.c +1 -1
index aae3b4e..98ae804 100644
@@ -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)
Signature · 1 line
OGAWA Hirofumi <[email protected]>
maintainer
#2 lore raw
Quoted 8 lines · OGAWA Hirofumi
Quoted 4 lines · Namjae Jeon

Since '*outlen' is initialized to zero,it is currently possible to
create a f ilename of length (FAT_LFN_LEN +1) when utf8 is not enabled.To enforce the FA T_LFN_LEN limit, we must perform one less iteration.

Please forward this too.

Quoted 19 lines
Quoted 19 lines
---
 fs/fat/namei_vfat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fat/namei_vfat.c +1 -1
index aae3b4e..98ae804 100644
@@ -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)
Signature · 1 line
OGAWA Hirofumi <[email protected]>
#3 lore raw
In reply to OGAWA Hirofumi

Hi. Andrew.

Would you plz check this patch also ?

Thanks.

2012/3/4 OGAWA Hirofumi <[email protected]>:

Quoted 28 lines
Quoted 1 line · Namjae Jeon

 Since '*outlen' is initialized to zero,it is currently possible to create a f ilename of length (FAT_LFN_LEN +1) when utf8 is not enabled.To enforce the FA T_LFN_LEN limit, we must perform one less iteration.

Quoted 11 lines

---
 fs/fat/namei_vfat.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
fs/fat/namei_vfat.c +0 -0
index aae3b4e..98ae804 100644

fs/fat/namei_vfat.c xlate_to_uni(const unsigned char *name, int len, unsigned char *outname, · line 528

Quoted 8 lines
fs/fat/namei_vfat.c +1 -1
@@ -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)

--
OGAWA Hirofumi <[email protected]>