[syslinux:pathbased] fat: fixing filenames with multiple-of-13 names broke all others
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Fri Mar 5 21:06:11 PST 2010
Commit-ID: ead9bc6ff2fdfffc2f0974bb8de02f54a7671922
Gitweb: http://syslinux.zytor.com/commit/ead9bc6ff2fdfffc2f0974bb8de02f54a7671922
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 5 Mar 2010 21:02:54 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Fri, 5 Mar 2010 21:02:54 -0800
fat: fixing filenames with multiple-of-13 names broke all others
The fix for filenames with names that were multiples of 13 broke all
*other* filenames. Fix both, this time...
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
core/fs/fat/fat.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/core/fs/fat/fat.c b/core/fs/fat/fat.c
index 3fe5521..e21a623 100644
--- a/core/fs/fat/fat.c
+++ b/core/fs/fat/fat.c
@@ -324,22 +324,20 @@ static bool vfat_match_longname(const char *str, const uint16_t *match,
unsigned char c = -1; /* Nonzero: we have not yet seen NUL */
uint16_t cp;
- while (len && (cp = *match)) {
- match++;
+ dprintf("Matching: %s\n", str);
+
+ while (len) {
+ cp = *match++;
len--;
+ if (!cp)
+ break;
c = *str++;
if (cp != codepage.uni[0][c] && cp != codepage.uni[1][c])
- return false;
- if (!c)
- break;
+ return false; /* Also handles c == '\0' */
}
- /*
- * If the filename is an exact multiple of 13, we have not yet
- * consumed the final null byte... make sure the next thing in the
- * pattern string really is a null byte.
- */
- if (c && *str)
+ /* This should have been the end of the matching string */
+ if (*str)
return false;
/* Any padding entries must be FFFF */
More information about the Syslinux-commits
mailing list