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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ecy16ub9.fsf@mail.parknet.co.jp>
Date: Thu, 10 Apr 2025 03:52:58 +0900
From: OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>
To: zhoumin <teczm@...mail.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] fat: Optimized FAT bad char check

zhoumin <teczm@...mail.com> writes:

> 1. Add first-Character Validation based on FAT Spec 6.1 ->
> Note the following -> 2
> 2. Add check for 0x7F (DEL character) even though the specification
> does not explicitly mention it

Why do you need this change?

Thanks.

> Signed-off-by: zhoumin <teczm@...mail.com>
> ---
>  fs/fat/namei_vfat.c | 23 ++++++++++-------------
>  1 file changed, 10 insertions(+), 13 deletions(-)
>
> diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
> index dd910edd2404..d264057f32aa 100644
> --- a/fs/fat/namei_vfat.c
> +++ b/fs/fat/namei_vfat.c
> @@ -195,16 +195,6 @@ static const struct dentry_operations vfat_dentry_ops = {
>  	.d_compare	= vfat_cmp,
>  };
>  
> -/* Characters that are undesirable in an MS-DOS file name */
> -
> -static inline bool vfat_bad_char(wchar_t w)
> -{
> -	return (w < 0x0020)
> -	    || (w == '*') || (w == '?') || (w == '<') || (w == '>')
> -	    || (w == '|') || (w == '"') || (w == ':') || (w == '/')
> -	    || (w == '\\');
> -}
> -
>  static inline bool vfat_replace_char(wchar_t w)
>  {
>  	return (w == '[') || (w == ']') || (w == ';') || (w == ',')
> @@ -220,10 +210,17 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
>  {
>  	int i;
>  
> -	for (i = 0; i < len; i++)
> -		if (vfat_bad_char(s[i]))
> -			return -EINVAL;
> +	for (i = 0; i < len; i++) {
> +		if (i == 0 && s[0] == 0x05)
> +			continue;
>  
> +		/* Characters that are undesirable in an MS-DOS file name */
> +		if ((s[i] < 0x0020) || (s[i] == '*') || (s[i] == '?') ||
> +			(s[i] == '<') || (s[i] == '>') || (s[i] == '|')
> +			|| (s[i] == '"') || (s[i] == ':') || (s[i] == '/')
> +			|| (s[i] == '\\') || (s[i] == 0x7f))
> +			return -EINVAL;
> +	}
>  	if (s[i - 1] == ' ') /* last character cannot be space */
>  		return -EINVAL;

-- 
OGAWA Hirofumi <hirofumi@...l.parknet.co.jp>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ