aboutsummaryrefslogtreecommitdiffstats
path: root/fsck
diff options
context:
space:
mode:
authorrelan <relan@users.noreply.github.com>2013-05-20 16:33:27 +0000
committerrelan <relan@users.noreply.github.com>2015-08-24 08:26:15 +0300
commit2a2e7d44f43e8f31c85fee3da7ddbc6282dbfbbd (patch)
tree559a2280ec3bf1435ba3ddd66bc9725050f28115 /fsck
parent2b59be2b66e94ec4ede08c3d0702cddb76105ea6 (diff)
downloadandroid_external_exfat-2a2e7d44f43e8f31c85fee3da7ddbc6282dbfbbd.tar.gz
android_external_exfat-2a2e7d44f43e8f31c85fee3da7ddbc6282dbfbbd.tar.bz2
android_external_exfat-2a2e7d44f43e8f31c85fee3da7ddbc6282dbfbbd.zip
Fix handling of long non-ASCII file names.
Diffstat (limited to 'fsck')
-rw-r--r--fsck/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/fsck/main.c b/fsck/main.c
index 421bd1d..e865641 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -40,18 +40,18 @@ static int nodeck(struct exfat* ef, struct exfat_node* node)
{
if (CLUSTER_INVALID(c))
{
- char name[EXFAT_NAME_MAX + 1];
+ char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1];
- exfat_get_name(node, name, EXFAT_NAME_MAX);
+ exfat_get_name(node, name, sizeof(name) - 1);
exfat_error("file `%s' has invalid cluster 0x%x", name, c);
rc = 1;
break;
}
if (BMAP_GET(ef->cmap.chunk, c - EXFAT_FIRST_DATA_CLUSTER) == 0)
{
- char name[EXFAT_NAME_MAX + 1];
+ char name[UTF8_BYTES(EXFAT_NAME_MAX) + 1];
- exfat_get_name(node, name, EXFAT_NAME_MAX);
+ exfat_get_name(node, name, sizeof(name) - 1);
exfat_error("cluster 0x%x of file `%s' is not allocated", c, name);
rc = 1;
}
@@ -77,7 +77,7 @@ static void dirck(struct exfat* ef, const char* path)
return;
path_length = strlen(path);
- entry_path = malloc(path_length + 1 + EXFAT_NAME_MAX);
+ entry_path = malloc(path_length + 1 + UTF8_BYTES(EXFAT_NAME_MAX) + 1);
if (entry_path == NULL)
{
exfat_error("out of memory");
@@ -96,7 +96,8 @@ static void dirck(struct exfat* ef, const char* path)
}
while ((node = exfat_readdir(ef, &it)))
{
- exfat_get_name(node, entry_path + path_length + 1, EXFAT_NAME_MAX);
+ exfat_get_name(node, entry_path + path_length + 1,
+ UTF8_BYTES(EXFAT_NAME_MAX));
exfat_debug("%s: %s, %"PRIu64" bytes, cluster %u", entry_path,
IS_CONTIGUOUS(*node) ? "contiguous" : "fragmented",
node->size, node->start_cluster);