Re: [PATCH 1/4] Move check for invalid chars to vfat_valid_longname()

From: René Scharfe
Date: Tue Nov 09 2004 - 11:25:11 EST


OGAWA Hirofumi wrote:
lsr@xxxxxxxxxxxxxxxxxxxxxxx writes:
+ /* check for invalid characters */
+ for (p = name; p < name + len; p++) {
+ if (*p < 0x0020 || strchr("*?<>|\":\\", *p) != NULL)
+ return 0;
+ }
+
return 1;
}

@@ -636,10 +627,6 @@ static int vfat_build_slots(struct inode
if (res < 0)
goto out_free;

- res = vfat_is_used_badchars(uname, ulen);
- if (res < 0)
- goto out_free;
-
res = vfat_create_shortname(dir, sbi->nls_disk, uname, ulen,
msdos_name, &lcase);
if (res < 0)


Some encodings is using the area of ascii code as second byte.

Yes. But..

So, it can't.

We want to make sure filenames don't contain '*', '?' etc. It doesn't matter whether we check the VFS idea of the filename (a simple C string) or some other encoding of it, no?

Right now we check for 0x002A after xlate_to_uni(), after the patch we check for 0x2A (ASCII code of '*') before xlate_to_uni() etc. I just translated the Unicode chars back to ASCII and moved the check.

Am I missing something?

Thanks,
René
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/