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 @@ #define SECTOR_SIZE 512 +/* Number of bytes reserved for a file name (including the trailing \0). + Since names are stored in the entry as UTF-8, we won't be able to + store all names allowed by FAT. In FAT, a name can have max 255 + characters (not bytes!). Since the UTF-8 encoding of a char may take + up to 4 bytes, there will be names that we won't be able to store + completely. For such names, the short DOS name is used. */ +#define FAT_FILENAME_BYTES 256 + struct fat_direntry { - unsigned char name[256]; /* Name plus \0 */ + unsigned char name[FAT_FILENAME_BYTES]; /* UTF-8 encoded name plus \0 */ unsigned short attr; /* Attributes */ unsigned char crttimetenth; /* Millisecond creation time stamp (0-199) */ |