X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=FatPkg%2FEnhancedFatDxe%2FFileName.c;h=f393aa6357b396c59c1889fccb4de7c9f1607049;hb=5d7cee9d3c3e15fd6ad87910d96c87e5aec12360;hp=09690fb07649e606db329badaf0066dadbcbe11f;hpb=d5955a904dfb4242634b3f9269bacf9bfa073e5e;p=mirror_edk2.git diff --git a/FatPkg/EnhancedFatDxe/FileName.c b/FatPkg/EnhancedFatDxe/FileName.c index 09690fb076..f393aa6357 100644 --- a/FatPkg/EnhancedFatDxe/FileName.c +++ b/FatPkg/EnhancedFatDxe/FileName.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -59,7 +59,7 @@ Returns: PossibleShortName = TRUE; SeparateDot = NULL; SetMem (File8Dot3Name, FAT_NAME_LEN, ' '); - for (TempName = FileName; *TempName; TempName++) { + for (TempName = FileName; *TempName != '\0'; TempName++) { if (*TempName == L'.') { SeparateDot = TempName; } @@ -302,7 +302,6 @@ Returns: CHAR16 Buffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1]; UINT8 OutCaseFlag; - ASSERT (StrSize (Str) <= sizeof (Buffer)); // // Assume the case of input string is mixed // @@ -311,7 +310,7 @@ Returns: // Lower case a copy of the string, if it matches the // original then the string is lower case // - StrCpy (Buffer, Str); + StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str); FatStrLwr (Buffer); if (StrCmp (Str, Buffer) == 0) { OutCaseFlag = InCaseFlag; @@ -320,7 +319,7 @@ Returns: // Upper case a copy of the string, if it matches the // original then the string is upper case // - StrCpy (Buffer, Str); + StrCpyS (Buffer, ARRAY_SIZE (Buffer), Str); FatStrUpr (Buffer); if (StrCmp (Str, Buffer) == 0) { OutCaseFlag = 0; @@ -392,8 +391,9 @@ Returns: VOID FatGetFileNameViaCaseFlag ( - IN FAT_DIRENT *DirEnt, - OUT CHAR16 *FileString + IN FAT_DIRENT *DirEnt, + IN OUT CHAR16 *FileString, + IN UINTN FileStringMax ) /*++ @@ -425,7 +425,7 @@ Returns: FatNameToStr (File8Dot3Name + FAT_MAIN_NAME_LEN, FAT_EXTEND_NAME_LEN, CaseFlag & FAT_CASE_EXT_LOWER, &TempExt[1]); if (TempExt[1] != 0) { TempExt[0] = L'.'; - StrCat (FileString, TempExt); + StrCatS (FileString, FileStringMax, TempExt); } } @@ -453,7 +453,7 @@ Returns: UINT8 Sum; Sum = 0; for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) { - Sum = (UINT8)(((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++); + Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++); } return Sum;