diff options
author | relan <relan@users.noreply.github.com> | 2010-07-24 10:06:26 +0000 |
---|---|---|
committer | relan <relan@users.noreply.github.com> | 2015-08-24 08:26:12 +0300 |
commit | 63e78a8d8b366d3cef65ee5c9028dd28767c318b (patch) | |
tree | fc4166a08b6c10854c1abdf1853c83f514208ede /libexfat/lookup.c | |
parent | 2b418b3f91652c55d53903a688048c5b92626839 (diff) | |
download | android_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.c | 19 |
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, |