diff options
-rw-r--r-- | libexfat/exfatfs.h | 1 | ||||
-rw-r--r-- | libexfat/node.c | 14 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libexfat/exfatfs.h b/libexfat/exfatfs.h index 7d8f8bf..87b47b5 100644 --- a/libexfat/exfatfs.h +++ b/libexfat/exfatfs.h @@ -69,6 +69,7 @@ STATIC_ASSERT(sizeof(struct exfat_super_block) == 512); #define EXFAT_ENTRY_VALID 0x80 #define EXFAT_ENTRY_CONTINUED 0x40 +#define EXFAT_ENTRY_OPTIONAL 0x20 #define EXFAT_ENTRY_BITMAP (0x01 | EXFAT_ENTRY_VALID) #define EXFAT_ENTRY_UPCASE (0x02 | EXFAT_ENTRY_VALID) diff --git a/libexfat/node.c b/libexfat/node.c index 912b4fc..6e18c09 100644 --- a/libexfat/node.c +++ b/libexfat/node.c @@ -454,11 +454,21 @@ static int readdir(struct exfat* ef, const struct exfat_node* parent, break; default: - if (entry->type & EXFAT_ENTRY_VALID) + if (!(entry->type & EXFAT_ENTRY_VALID)) + break; /* deleted entry, ignore it */ + if (!(entry->type & EXFAT_ENTRY_OPTIONAL)) { - exfat_error("unknown entry type 0x%hhx", entry->type); + exfat_error("unknown entry type %#hhx", entry->type); goto error; } + /* optional entry, warn and skip */ + exfat_warn("unknown entry type %#hhx", entry->type); + if (continuations == 0) + { + exfat_error("unexpected continuation"); + goto error; + } + --continuations; break; } |