]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Fix a potential buffer over flow issue.
authorRuiyu Ni <ruiyu.ni@intel.com>
Wed, 13 Aug 2014 07:00:57 +0000 (07:00 +0000)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 7 Apr 2016 06:22:43 +0000 (23:22 -0700)
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
(based on FatPkg commit 2355ea2cf327c047d7d448a1ae4e606707c82ded)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
FatPkg/EnhancedFatDxe/Hash.c

index a06accb58b2f55ce3b53371a2e3e0d6cabbb4b92..dd67bab313d9c8ef9e5bd3dcb5bb8e0dfdcc0e2b 100644 (file)
@@ -1,6 +1,6 @@
 /*++\r
 \r
-Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2005 - 2014, 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
@@ -47,7 +47,8 @@ Returns:
 {\r
   UINT32  HashValue;\r
   CHAR16  UpCasedLongFileName[EFI_PATH_STRING_LENGTH];\r
-  StrCpy (UpCasedLongFileName, LongNameString);\r
+  StrnCpy (UpCasedLongFileName, LongNameString, EFI_PATH_STRING_LENGTH - 1);\r
+  UpCasedLongFileName[EFI_PATH_STRING_LENGTH - 1] = L'\0';\r
   FatStrUpr (UpCasedLongFileName);\r
   gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);\r
   return (HashValue & HASH_TABLE_MASK);\r