mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 09:59:18 +01:00
Added space to list of illegal alias characters - fixes filename creation bug when filename contained a space
This commit is contained in:
parent
c394419d72
commit
4a0c7c4046
@ -43,6 +43,9 @@
|
||||
|
||||
2007-03-14 - Chishm
|
||||
* Check long file names for buffer overflow
|
||||
|
||||
2007-04-22 - Chishm
|
||||
* Added space to list of illegal alias characters - fixes filename creation bug when filename contained a space
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -89,6 +92,9 @@ const int LFN_offset_table[13]={0x01,0x03,0x05,0x07,0x09,0x0E,0x10,0x12,0x14,0x1
|
||||
#define LFN_END 0x40
|
||||
#define LFN_DEL 0x80
|
||||
|
||||
const char ILLEGAL_ALIAS_CHARACTERS[] = "\\/:;*?\"<>|&+,=[] ";
|
||||
const char ILLEGAL_LFN_CHARACTERS[] = "\\/:*?\"<>|";
|
||||
|
||||
bool _FAT_directory_isValidLfn (const char* name) {
|
||||
u32 i;
|
||||
u32 nameLength;
|
||||
@ -97,7 +103,7 @@ bool _FAT_directory_isValidLfn (const char* name) {
|
||||
return false;
|
||||
}
|
||||
// Make sure it doesn't contain any invalid characters
|
||||
if (strpbrk (name, "\\/:*?\"<>|") != NULL) {
|
||||
if (strpbrk (name, ILLEGAL_LFN_CHARACTERS) != NULL) {
|
||||
return false;
|
||||
}
|
||||
nameLength = strnlen(name, MAX_FILENAME_LENGTH);
|
||||
@ -121,7 +127,7 @@ bool _FAT_directory_isValidAlias (const char* name) {
|
||||
return false;
|
||||
}
|
||||
// Make sure it doesn't contain any invalid characters
|
||||
if (strpbrk (name, "\\/:;*?\"<>|&+,=[]") != NULL) {
|
||||
if (strpbrk (name, ILLEGAL_ALIAS_CHARACTERS) != NULL) {
|
||||
return false;
|
||||
}
|
||||
nameLength = strnlen(name, MAX_ALIAS_LENGTH);
|
||||
|
Loading…
Reference in New Issue
Block a user