aboutsummaryrefslogtreecommitdiffstats
path: root/libexfat/lookup.c
diff options
context:
space:
mode:
authorrelan <relan@users.noreply.github.com>2010-07-24 10:06:26 +0000
committerrelan <relan@users.noreply.github.com>2015-08-24 08:26:12 +0300
commit63e78a8d8b366d3cef65ee5c9028dd28767c318b (patch)
treefc4166a08b6c10854c1abdf1853c83f514208ede /libexfat/lookup.c
parent2b418b3f91652c55d53903a688048c5b92626839 (diff)
downloadandroid_external_exfat-63e78a8d8b366d3cef65ee5c9028dd28767c318b.tar.gz
android_external_exfat-63e78a8d8b366d3cef65ee5c9028dd28767c318b.tar.bz2
android_external_exfat-63e78a8d8b366d3cef65ee5c9028dd28767c318b.zip
Improve allowed file name characters filter.
Diffstat (limited to 'libexfat/lookup.c')
-rw-r--r--libexfat/lookup.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/libexfat/lookup.c b/libexfat/lookup.c
index b08ce43..619dcea 100644
--- a/libexfat/lookup.c
+++ b/libexfat/lookup.c
@@ -154,7 +154,24 @@ static int is_last_comp(const char* comp, size_t length)
static int is_allowed(const char* comp, size_t length)
{
- return strcspn(comp, "/\\:*?\"<>|") >= length;
+ size_t i;
+
+ for (i = 0; i < length; i++)
+ switch (comp[i])
+ {
+ case 0x01 ... 0x1f:
+ case '/':
+ case '\\':
+ case ':':
+ case '*':
+ case '?':
+ case '"':
+ case '<':
+ case '>':
+ case '|':
+ return 0;
+ }
+ return 1;
}
int exfat_split(struct exfat* ef, struct exfat_node** parent,