diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-28 12:32:06 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-09-28 12:32:06 +0000 |
commit | efc2abcacd38e0a2a4ec330442b82343c40bac18 (patch) | |
tree | 960f06335e673f5b92a1158737f76aa010128b6c /nuttx/fs/fat | |
parent | fb2ef5eeadae97a04f0e35783912f0ecef7dee65 (diff) | |
download | px4-nuttx-efc2abcacd38e0a2a4ec330442b82343c40bac18.tar.gz px4-nuttx-efc2abcacd38e0a2a4ec330442b82343c40bac18.tar.bz2 px4-nuttx-efc2abcacd38e0a2a4ec330442b82343c40bac18.zip |
Back out a portion of the last FAT LFN change
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3986 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/fat')
-rw-r--r-- | nuttx/fs/fat/fs_fat32dirent.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/nuttx/fs/fat/fs_fat32dirent.c b/nuttx/fs/fat/fs_fat32dirent.c index 6e6d82d10..a8c65b8de 100644 --- a/nuttx/fs/fat/fs_fat32dirent.c +++ b/nuttx/fs/fat/fs_fat32dirent.c @@ -1123,31 +1123,25 @@ static bool fat_cmplfname(const uint8_t *direntry, const uint8_t *substr) int len; bool match; - /* How much of string do we have to compare? */ + /* How much of string do we have to compare? (including the NUL + * terminator). + */ - len = strlen((char*)substr); + len = strlen((char*)substr) + 1; /* Check bytes 1-5 */ chunk = LDIR_PTRWCHAR1_5(direntry); match = fat_cmplfnchunk(chunk, substr, 5); - if (match && len >= 5) + if (match && len > 5) { - /* Check bytes 6-11. Note that if len == 5, the substring passed to - * fat_cmplfnchunk() will point to the NUL terminator of substr. - * In this case, fat_cmplfnchunk() will only verify that the - * directory entry is also NUL terminated. - */ + /* Check bytes 6-11 */ chunk = LDIR_PTRWCHAR6_11(direntry); match = fat_cmplfnchunk(chunk, &substr[5], 6); - if (match && len >= 11) + if (match && len > 11) { - /* Check bytes 12-13. Note that if len == 11, the substring passed to - * fat_cmplfnchunk() will point to the NUL terminator of substr. - * In this case, fat_cmplfnchunk() will only verify that the - * directory entry is also NUL terminated. - */ + /* Check bytes 12-13 */ chunk = LDIR_PTRWCHAR12_13(direntry); match = fat_cmplfnchunk(chunk, &substr[11], 2); |