]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/EnhancedFatDxe/Hash.c
FatPkg EnhancedFatDxe: Use safe string functions
[mirror_edk2.git] / FatPkg / EnhancedFatDxe / Hash.c
index c0fbab2f1e2653e30596a65ea404d9917dda57dd..3d0ffe6fb8793c53cfefda4c3f333eda17795a3e 100644 (file)
@@ -1,7 +1,7 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials are licensed and made available\r
+Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
 distribution. The full text of the license may be found at\r
 http://opensource.org/licenses/bsd-license.php\r
@@ -47,7 +47,12 @@ Returns:
 {\r
   UINT32  HashValue;\r
   CHAR16  UpCasedLongFileName[EFI_PATH_STRING_LENGTH];\r
-  StrCpy (UpCasedLongFileName, LongNameString);\r
+  StrnCpyS (\r
+    UpCasedLongFileName,\r
+    sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]),\r
+    LongNameString,\r
+    sizeof (UpCasedLongFileName) / sizeof (UpCasedLongFileName[0]) - 1\r
+    );\r
   FatStrUpr (UpCasedLongFileName);\r
   gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);\r
   return (HashValue & HASH_TABLE_MASK);\r