summaryrefslogtreecommitdiffstats
path: root/FatPkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2014-08-13 07:00:57 +0000
committerJordan Justen <jordan.l.justen@intel.com>2016-04-06 23:22:43 -0700
commitee3e5604cf2e3b79075cda62986b1fa627f21e09 (patch)
tree3afe8521b5efb7c5dc040cc1bfe955f4a863c12f /FatPkg
parent944ac8ab53ada1da0ad6068e33fdd9b8469b89e7 (diff)
downloadedk2-ee3e5604cf2e3b79075cda62986b1fa627f21e09.tar.gz
edk2-ee3e5604cf2e3b79075cda62986b1fa627f21e09.tar.bz2
edk2-ee3e5604cf2e3b79075cda62986b1fa627f21e09.zip
Fix a potential buffer over flow issue.
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>
Diffstat (limited to 'FatPkg')
-rw-r--r--FatPkg/EnhancedFatDxe/Hash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/FatPkg/EnhancedFatDxe/Hash.c b/FatPkg/EnhancedFatDxe/Hash.c
index a06accb58b..dd67bab313 100644
--- a/FatPkg/EnhancedFatDxe/Hash.c
+++ b/FatPkg/EnhancedFatDxe/Hash.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2005 - 2007, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
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
@@ -47,7 +47,8 @@ Returns:
{
UINT32 HashValue;
CHAR16 UpCasedLongFileName[EFI_PATH_STRING_LENGTH];
- StrCpy (UpCasedLongFileName, LongNameString);
+ StrnCpy (UpCasedLongFileName, LongNameString, EFI_PATH_STRING_LENGTH - 1);
+ UpCasedLongFileName[EFI_PATH_STRING_LENGTH - 1] = L'\0';
FatStrUpr (UpCasedLongFileName);
gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);
return (HashValue & HASH_TABLE_MASK);