lookup.c (02.09.09)
exFAT file system implementation library.
- Copyright (C) 2009, 2010 Andrew Nayenko
+ Copyright (C) 2010-2013 Andrew Nayenko
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
return 0;
}
-static int is_last_comp(const char* comp, size_t length)
+static bool is_last_comp(const char* comp, size_t length)
{
const char* p = comp + length;
return get_comp(p, &p) == 0;
}
-static int is_allowed(const char* comp, size_t length)
+static bool 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 false;
+ }
+ return true;
}
int exfat_split(struct exfat* ef, struct exfat_node** parent,
size_t n;
int rc;
+ memset(name, 0, (EXFAT_NAME_MAX + 1) * sizeof(le16_t));
*parent = *node = exfat_get_node(ef->root);
for (p = path; (n = get_comp(p, &p)); p += n)
{