diff options
author | Rani Hod <raenye@gmail.com> | 2006-07-31 22:59:45 +0000 |
---|---|---|
committer | Rani Hod <raenye@gmail.com> | 2006-07-31 22:59:45 +0000 |
commit | 8630f072e9b544cb9b58291fe3a60daccc899d46 (patch) | |
tree | 7d71280a489b4d58c9a8f3ee9bcdceabefac904c /firmware/export/fat.h | |
parent | cc839a26711069399ec86cdb63b2d246fa3395d2 (diff) | |
download | rockbox-8630f072e9b544cb9b58291fe3a60daccc899d46.tar.gz rockbox-8630f072e9b544cb9b58291fe3a60daccc899d46.zip |
Applied FS# 5736 by Alexander Levin.
Fixed fat buffer overflow with LFNs longer than 255 bytes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10389 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/fat.h')
-rw-r--r-- | firmware/export/fat.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/firmware/export/fat.h b/firmware/export/fat.h index c56d8f85f6..4cdc479844 100644 --- a/firmware/export/fat.h +++ b/firmware/export/fat.h | |||
@@ -25,9 +25,17 @@ | |||
25 | 25 | ||
26 | #define SECTOR_SIZE 512 | 26 | #define SECTOR_SIZE 512 |
27 | 27 | ||
28 | /* Number of bytes reserved for a file name (including the trailing \0). | ||
29 | Since names are stored in the entry as UTF-8, we won't be able to | ||
30 | store all names allowed by FAT. In FAT, a name can have max 255 | ||
31 | characters (not bytes!). Since the UTF-8 encoding of a char may take | ||
32 | up to 4 bytes, there will be names that we won't be able to store | ||
33 | completely. For such names, the short DOS name is used. */ | ||
34 | #define FAT_FILENAME_BYTES 256 | ||
35 | |||
28 | struct fat_direntry | 36 | struct fat_direntry |
29 | { | 37 | { |
30 | unsigned char name[256]; /* Name plus \0 */ | 38 | unsigned char name[FAT_FILENAME_BYTES]; /* UTF-8 encoded name plus \0 */ |
31 | unsigned short attr; /* Attributes */ | 39 | unsigned short attr; /* Attributes */ |
32 | unsigned char crttimetenth; /* Millisecond creation | 40 | unsigned char crttimetenth; /* Millisecond creation |
33 | time stamp (0-199) */ | 41 | time stamp (0-199) */ |