summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal
diff options
context:
space:
mode:
authorFeng Tian <feng.tian@intel.com>2014-08-07 08:54:34 +0000
committererictian <erictian@6f19259b-4bc3-4df7-8a09-765794883524>2014-08-07 08:54:34 +0000
commit6e1e5405544724406f07344a5911298c3df44129 (patch)
tree1f723606676a8f4fef5ac4aac1682c171ce21381 /MdeModulePkg/Universal
parente935092fa7e1401201e6faadb04b0ae239dd97a5 (diff)
downloadedk2-6e1e5405544724406f07344a5911298c3df44129.zip
edk2-6e1e5405544724406f07344a5911298c3df44129.tar.gz
edk2-6e1e5405544724406f07344a5911298c3df44129.tar.bz2
1) Add type cast for better coding style.
2) replace StrCpy() usage in Variable driver with StrnCpy(). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15770 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal')
-rw-r--r--MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c8
-rw-r--r--MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c4
-rw-r--r--MdeModulePkg/Universal/EbcDxe/EbcExecute.c4
-rw-r--r--MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c4
-rw-r--r--MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c6
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Font.c8
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/Image.c12
-rw-r--r--MdeModulePkg/Universal/HiiDatabaseDxe/String.c26
-rw-r--r--MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c10
-rw-r--r--MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c12
10 files changed, 47 insertions, 47 deletions
diff --git a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c
index a7b53e2..30f71bd 100644
--- a/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c
+++ b/MdeModulePkg/Universal/Acpi/AcpiTableDxe/Aml.c
@@ -1,7 +1,7 @@
/** @file
ACPI Sdt Protocol Driver
- Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved. <BR>
+ Copyright (c) 2010 - 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
@@ -282,13 +282,13 @@ AmlGetPkgLength (
break;
case 2:
RealLength = *(Buffer + 1);
- RealLength |= (*(Buffer + 2)) << 8;
+ RealLength |= (UINTN)((*(Buffer + 2)) << 8);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
case 3:
RealLength = *(Buffer + 1);
- RealLength |= (*(Buffer + 2)) << 8;
- RealLength |= (*(Buffer + 3)) << 16;
+ RealLength |= (UINTN)((*(Buffer + 2)) << 8);
+ RealLength |= (UINTN)((*(Buffer + 3)) << 16);
RealLength = (RealLength << 4) | (LeadByte & 0xF);
break;
default:
diff --git a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
index ab18587..6c1c304 100644
--- a/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
+++ b/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c
@@ -4,7 +4,7 @@
This driver is dispatched by Dxe core and the driver will reload itself to ACPI reserved memory
in the entry point. The functionality is to interpret and restore the S3 boot script
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
@@ -280,7 +280,7 @@ ReadyToLockEventNotify (
// Align buffer on section boundry
//
ImageContext.ImageAddress += ImageContext.SectionAlignment - 1;
- ImageContext.ImageAddress &= ~(ImageContext.SectionAlignment - 1);
+ ImageContext.ImageAddress &= ~((EFI_PHYSICAL_ADDRESS)(ImageContext.SectionAlignment - 1));
//
// Load the image to our new buffer
//
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
index 69aee07..433eea2 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcExecute.c
@@ -3269,7 +3269,7 @@ ExecuteCMP (
if (Flag != 0) {
VMFLAG_SET (VmPtr, VMFLAGS_CC);
} else {
- VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);
+ VMFLAG_CLEAR (VmPtr, (UINT64)VMFLAGS_CC);
}
//
// Advance the IP
@@ -3448,7 +3448,7 @@ ExecuteCMPI (
if (Flag != 0) {
VMFLAG_SET (VmPtr, VMFLAGS_CC);
} else {
- VMFLAG_CLEAR (VmPtr, VMFLAGS_CC);
+ VMFLAG_CLEAR (VmPtr, (UINT64)VMFLAGS_CC);
}
//
// Advance the IP
diff --git a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c
index 41dc3a8..bddfbf6 100644
--- a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c
+++ b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c
@@ -2,7 +2,7 @@
This module contains EBC support routines that are customized based on
the target ia32 processor.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
@@ -267,7 +267,7 @@ EbcInterpret (
VmContext.StackTop = (UINT8*)VmContext.StackPool + (STACK_REMAIN_SIZE);
VmContext.Gpr[0] = (UINT64)(UINTN) ((UINT8*)VmContext.StackPool + STACK_POOL_SIZE);
VmContext.HighStackBottom = (UINTN)VmContext.Gpr[0];
- VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);
+ VmContext.Gpr[0] &= ~((VM_REGISTER)(sizeof (UINTN) - 1));
VmContext.Gpr[0] -= sizeof (UINTN);
//
diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c
index 3f99a1a..bdde5e4 100644
--- a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c
+++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c
@@ -2,7 +2,7 @@
This module contains EBC support routines that are customized based on
the target x64 processor.
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
@@ -215,7 +215,7 @@ EbcInterpret (
//
// Align the stack on a natural boundary.
//
- VmContext.Gpr[0] &= ~(sizeof (UINTN) - 1);
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof (UINTN) - 1);
//
// Put a magic value in the stack gap, then adjust down again.
@@ -359,7 +359,7 @@ ExecuteEbcImageEntryPoint (
//
// Align the stack on a natural boundary
- VmContext.Gpr[0] &= ~(sizeof(UINTN) - 1);
+ VmContext.Gpr[0] &= ~(VM_REGISTER)(sizeof(UINTN) - 1);
//
VmContext.LowStackTop = (UINTN) VmContext.Gpr[0];
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index eef31d5..6cc350c 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -757,12 +757,12 @@ FindGlyphBlock (
break;
case EFI_HII_GIBT_EXT1:
- BlockPtr += *(BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));
+ BlockPtr += *(UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8));
break;
case EFI_HII_GIBT_EXT2:
CopyMem (
&Length16,
- BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
BlockPtr += Length16;
@@ -770,7 +770,7 @@ FindGlyphBlock (
case EFI_HII_GIBT_EXT4:
CopyMem (
&Length32,
- BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GLYPH_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
BlockPtr += Length32;
@@ -793,7 +793,7 @@ FindGlyphBlock (
BufferLen = BITMAP_LEN_1_BIT (LocalCell.Width, LocalCell.Height);
if (CharCurrent == CharValue) {
return WriteOutputParam (
- BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8),
+ (UINT8*)((UINTN)BlockPtr + sizeof (EFI_HII_GIBT_GLYPH_BLOCK) - sizeof (UINT8)),
BufferLen,
&LocalCell,
GlyphBuffer,
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
index ed0cf83..560cf8f 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Image.c
@@ -79,13 +79,13 @@ GetImageIdOrAddress (
}
switch (((EFI_HII_IMAGE_BLOCK *) ImageBlock)->BlockType) {
case EFI_HII_IIBT_EXT1:
- Length8 = *(ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));
+ Length8 = *(UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8));
ImageBlock += Length8;
break;
case EFI_HII_IIBT_EXT2:
CopyMem (
&Length16,
- ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
ImageBlock += Length16;
@@ -93,7 +93,7 @@ GetImageIdOrAddress (
case EFI_HII_IIBT_EXT4:
CopyMem (
&Length32,
- ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)ImageBlock + sizeof (EFI_HII_IMAGE_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
ImageBlock += Length32;
@@ -920,19 +920,19 @@ HiiGetImage (
if (BlockType == EFI_HII_IIBT_IMAGE_1BIT || BlockType == EFI_HII_IIBT_IMAGE_1BIT_TRANS) {
Output1bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_1BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
} else if (BlockType == EFI_HII_IIBT_IMAGE_4BIT || BlockType == EFI_HII_IIBT_IMAGE_4BIT_TRANS) {
Output4bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_4BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
} else {
Output8bitPixel (
Image,
- (UINT8 *) (ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),
+ (UINT8 *) ((UINTN)ImageBlock + sizeof (EFI_HII_IIBT_IMAGE_8BIT_BLOCK) - sizeof (UINT8)),
(EFI_HII_IMAGE_PALETTE_INFO *) PaletteInfo
);
}
diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
index f3c0555..1f4be0c 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/String.c
@@ -2,7 +2,7 @@
Implementation for EFI_HII_STRING_PROTOCOL.
-Copyright (c) 2007 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2007 - 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
@@ -335,7 +335,7 @@ FindStringBlock (
case EFI_HII_SIBT_STRINGS_SCSU:
CopyMem (&StringCount, BlockHdr + sizeof (EFI_HII_STRING_BLOCK), sizeof (UINT16));
- StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8);
+ StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_BLOCK) - sizeof (UINT8));
BlockSize += StringTextPtr - BlockHdr;
for (Index = 0; Index < StringCount; Index++) {
@@ -355,10 +355,10 @@ FindStringBlock (
case EFI_HII_SIBT_STRINGS_SCSU_FONT:
CopyMem (
&StringCount,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
- StringTextPtr = BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8);
+ StringTextPtr = (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_SIBT_STRINGS_SCSU_FONT_BLOCK) - sizeof (UINT8));
BlockSize += StringTextPtr - BlockHdr;
for (Index = 0; Index < StringCount; Index++) {
@@ -425,7 +425,7 @@ FindStringBlock (
BlockSize += Offset;
CopyMem (
&StringCount,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT16)
);
for (Index = 0; Index < StringCount; Index++) {
@@ -465,7 +465,7 @@ FindStringBlock (
break;
case EFI_HII_SIBT_SKIP1:
- SkipCount = (UINT16) (*(BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
+ SkipCount = (UINT16) (*(UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK)));
CurrentStringId = (UINT16) (CurrentStringId + SkipCount);
BlockSize += sizeof (EFI_HII_SIBT_SKIP1_BLOCK);
break;
@@ -479,7 +479,7 @@ FindStringBlock (
case EFI_HII_SIBT_EXT1:
CopyMem (
&Length8,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT8)
);
BlockSize += Length8;
@@ -494,7 +494,7 @@ FindStringBlock (
//
BlockHdr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
CopyMem (&FontId, BlockHdr, sizeof (UINT8));
- BlockHdr += sizeof (UINT8);
+ BlockHdr ++;
CopyMem (&FontSize, BlockHdr, sizeof (UINT16));
BlockHdr += sizeof (UINT16);
CopyMem (&FontStyle, BlockHdr, sizeof (EFI_HII_FONT_STYLE));
@@ -535,7 +535,7 @@ FindStringBlock (
case EFI_HII_SIBT_EXT4:
CopyMem (
&Length32,
- BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8),
+ (UINT8*)((UINTN)BlockHdr + sizeof (EFI_HII_STRING_BLOCK) + sizeof (UINT8)),
sizeof (UINT32)
);
@@ -1080,7 +1080,7 @@ SetStringWorker (
BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, &GlobalFont->FontInfo->FontSize, sizeof (UINT16));
BlockPtr += sizeof (UINT16);
CopyMem (BlockPtr, &GlobalFont->FontInfo->FontStyle, sizeof (UINT32));
@@ -1442,7 +1442,7 @@ HiiNewString (
*BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
BlockPtr += sizeof (EFI_HII_STRING_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));
BlockPtr += StrSize ((EFI_STRING) String);
@@ -1486,7 +1486,7 @@ HiiNewString (
BlockPtr += sizeof (EFI_HII_SIBT_EXT2_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontSize, sizeof (UINT16));
BlockPtr += sizeof (UINT16);
CopyMem (BlockPtr, &((EFI_FONT_INFO *) StringFontInfo)->FontStyle, sizeof (EFI_HII_FONT_STYLE));
@@ -1503,7 +1503,7 @@ HiiNewString (
*BlockPtr = EFI_HII_SIBT_STRING_UCS2_FONT;
BlockPtr += sizeof (EFI_HII_STRING_BLOCK);
*BlockPtr = LocalFont->FontId;
- BlockPtr += sizeof (UINT8);
+ BlockPtr ++;
CopyMem (BlockPtr, (EFI_STRING) String, StrSize ((EFI_STRING) String));
BlockPtr += StrSize ((EFI_STRING) String);
diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
index ae31e3a..e076840 100644
--- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
+++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c
@@ -3,7 +3,7 @@
Emulation Variable services operate on the runtime volatile memory.
The nonvolatile variable space doesn't exist.
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 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
@@ -320,9 +320,9 @@ UpdateVariableInfo (
ASSERT (gVariableInfo != NULL);
CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
- gVariableInfo->Name = AllocatePool (StrSize (VariableName));
+ gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (gVariableInfo->Name != NULL);
- StrCpy (gVariableInfo->Name, VariableName);
+ StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));
gVariableInfo->Volatile = Volatile;
gBS->InstallConfigurationTable (&gEfiVariableGuid, gVariableInfo);
@@ -358,9 +358,9 @@ UpdateVariableInfo (
ASSERT (Entry->Next != NULL);
CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
- Entry->Next->Name = AllocatePool (StrSize (VariableName));
+ Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (Entry->Next->Name != NULL);
- StrCpy (Entry->Next->Name, VariableName);
+ StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));
Entry->Next->Volatile = Volatile;
}
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 9101da3..fc7fbab 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -139,9 +139,9 @@ UpdateVariableInfo (
ASSERT (gVariableInfo != NULL);
CopyGuid (&gVariableInfo->VendorGuid, VendorGuid);
- gVariableInfo->Name = AllocatePool (StrSize (VariableName));
+ gVariableInfo->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (gVariableInfo->Name != NULL);
- StrCpy (gVariableInfo->Name, VariableName);
+ StrnCpy (gVariableInfo->Name, VariableName, StrLen (VariableName));
gVariableInfo->Volatile = Volatile;
}
@@ -175,9 +175,9 @@ UpdateVariableInfo (
ASSERT (Entry->Next != NULL);
CopyGuid (&Entry->Next->VendorGuid, VendorGuid);
- Entry->Next->Name = AllocatePool (StrSize (VariableName));
+ Entry->Next->Name = AllocateZeroPool (StrSize (VariableName));
ASSERT (Entry->Next->Name != NULL);
- StrCpy (Entry->Next->Name, VariableName);
+ StrnCpy (Entry->Next->Name, VariableName, StrLen (VariableName));
Entry->Next->Volatile = Volatile;
}
@@ -2251,7 +2251,7 @@ VariableLockRequestToLock (
return EFI_ACCESS_DENIED;
}
- Entry = AllocateRuntimePool (sizeof (*Entry) + StrSize (VariableName));
+ Entry = AllocateRuntimeZeroPool (sizeof (*Entry) + StrSize (VariableName));
if (Entry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
@@ -2261,7 +2261,7 @@ VariableLockRequestToLock (
AcquireLockOnlyAtBootTime(&mVariableModuleGlobal->VariableGlobal.VariableServicesLock);
Entry->Name = (CHAR16 *) (Entry + 1);
- StrCpy (Entry->Name, VariableName);
+ StrnCpy (Entry->Name, VariableName, StrLen (VariableName));
CopyGuid (&Entry->Guid, VendorGuid);
InsertTailList (&mLockedVariableList, &Entry->Link);