Messages in this thread Patch in this message | | | Subject | Re: [RFC] FAT extension filters | From | OGAWA Hirofumi <> | Date | Thu, 16 May 2002 22:46:41 +0900 |
| |
"Albert D. Cahalan" <acahalan@cs.uml.edu> writes:
> Using plain old MS-DOS, or Linux right before the > vfat code was merged, create a file with this name: > > E5 44 05 44 E5 44 44 44 44 E5 05 > > On disk it gets stored as this: > > 05 44 05 44 E5 44 44 44 44 E5 05 > ^^ > > Now remount or reboot so you don't cheat by > accident. Do an "ls -l" and note that you > see the original filename. The 0xE5 is at > the beginning of the name, and the 0x05 in > the middle has not been mangled.
Ah, yes. Indeed.
I'll submit the following patch to Linus. Thanks.
diff -urN linux-bk/fs/fat/dir.c linux-2.5.14/fs/fat/dir.c --- linux-bk/fs/fat/dir.c Mon May 13 02:28:29 2002 +++ linux-2.5.14/fs/fat/dir.c Thu May 16 22:39:32 2002 @@ -271,13 +271,10 @@ long_slots = 0; } - for (i = 0; i < 8; i++) { - /* see namei.c, msdos_format_name */ - if (de->name[i] == 0x05) - work[i] = 0xE5; - else - work[i] = de->name[i]; - } + /* see namei.c, msdos_format_name */ + memcpy(work, de->name, sizeof(de->name)); + if (de->name[0] == 0x05) + work[0] = 0xE5; for (i = 0, j = 0, last_u = 0; i < 8;) { if (!work[i]) break; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, @@ -478,13 +475,10 @@ dotoffset = 1; } - for (i = 0; i < 8; i++) { - /* see namei.c, msdos_format_name */ - if (de->name[i] == 0x05) - work[i] = 0xE5; - else - work[i] = de->name[i]; - } + /* see namei.c, msdos_format_name */ + memcpy(work, de->name, sizeof(de->name)); + if (de->name[0] == 0x05) + work[0] = 0xE5; for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) { if (!(c = work[i])) break; chl = fat_shortname2uni(nls_disk, &work[i], 8 - i, -- OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |