lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <196f7191-5820-4480-99d3-e7ffc66e9c98@t-8ch.de>
Date:   Mon, 31 Jul 2023 07:55:39 +0200
From:   Thomas Weißschuh <thomas@...ch.de>
To:     tjcw@...tab.net
Cc:     linux-kernel@...r.kernel.org
Subject: Re: vfat file system does not allow a space at the end of a
 directory name

Hi Chris,

On 2023-07-30 23:33:03+0100, Chris Ward wrote:
> I had a zip file (from downloading pictures from Google Photos) where
> some of the directory names had a space at the end. This unzipped fine
> on an ext4 file system, but gave errors when unpacking onto a USB key
> which had a FAT file system.
> 
> On further investigation, file names have the same problem. On my USB key, I get
> 
> tjcw@...w-OptiPlex-7010:/media/tjcw/Photos$ touch 'aab '
> touch: setting times of 'aab ': No such file or directory
> tjcw@...w-OptiPlex-7010:/media/tjcw/Photos$ echo ok >'aab '
> bash: aab : Invalid argument
> tjcw@...w-OptiPlex-7010:/media/tjcw/Photos$ touch 'aab'
> tjcw@...w-OptiPlex-7010:/media/tjcw/Photos$ echo ok >'aab'
> tjcw@...w-OptiPlex-7010:/media/tjcw/Photos$
> 
> Is this as expected, or is it a bug in the kernel's handling of FAT
> file systems ? Probably the next step is to check the behaviour under
> Microsoft Windows.

AFAIK this is a limitation in the FAT filesystem itself.

The problem is that FAT stores filenames in fixed width fields.
Unused space in these fields is filled with ' '.
This means that storing "foo", "foo " or "foo ". would all result in the
exact same result and it will be impossible to figure out the correct
one afterwards.

>From Wikipedia [0]:

    trailing spaces in either the base name or the extension are
    considered to be padding and not a part of the file name

>From fs/fat/namei_vfat.c vfat_is_used_badchars():

    last character cannot be space

[0] https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ