diff options
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r-- | firmware/drivers/fat.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 20c8f2b8e0..ebf0f92798 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c | |||
@@ -659,11 +659,14 @@ static inline unsigned int longent_char_next(unsigned int i) | |||
659 | { | 659 | { |
660 | switch (i += 2) | 660 | switch (i += 2) |
661 | { | 661 | { |
662 | /* flip endian for elements 14 - 27 */ | ||
662 | case 26: i -= 1; /* return 28 */ | 663 | case 26: i -= 1; /* return 28 */ |
664 | /* Fall-Through */ | ||
663 | case 11: i += 3; /* return 14 */ | 665 | case 11: i += 3; /* return 14 */ |
664 | } | 666 | } |
665 | 667 | /* BYTES2INT16() uses [i + 0] and [i + 1] therefore | |
666 | return i < 32 ? i : 0; | 668 | * 30 is the max element available in the raw byte array of size 32 */ |
669 | return i < 31 ? i : 0; | ||
667 | } | 670 | } |
668 | 671 | ||
669 | /* initialize the parse state; call before parsing first long entry */ | 672 | /* initialize the parse state; call before parsing first long entry */ |
@@ -1708,6 +1711,7 @@ static int add_dir_entry(struct bpb *fat_bpb, struct fat_filestr *parentstr, | |||
1708 | int dots = strlcpy(shortname, name, 11); | 1711 | int dots = strlcpy(shortname, name, 11); |
1709 | memset(&shortname[dots], ' ', 11 - dots); | 1712 | memset(&shortname[dots], ' ', 11 - dots); |
1710 | entries_needed = 1; | 1713 | entries_needed = 1; |
1714 | basisname[0] = '\0'; | ||
1711 | } | 1715 | } |
1712 | else | 1716 | else |
1713 | { | 1717 | { |