summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg/Library
diff options
context:
space:
mode:
authorMichael D Kinney <michael.d.kinney@intel.com>2019-08-06 17:10:03 -0700
committerMichael D Kinney <michael.d.kinney@intel.com>2019-08-19 09:49:54 -0700
commit9e3ab94dc871926392b35dcf44c72ea74b1dd134 (patch)
tree54b530f4fdf3650ad4b5c22fe7db7c0f212d116c /EmulatorPkg/Library
parent50509ec66c7a23acee1aaedfb5fb63871ee9b522 (diff)
downloadedk2-9e3ab94dc871926392b35dcf44c72ea74b1dd134.tar.gz
edk2-9e3ab94dc871926392b35dcf44c72ea74b1dd134.tar.bz2
edk2-9e3ab94dc871926392b35dcf44c72ea74b1dd134.zip
EmulatorPkg: Add -D DISABLE_NEW_DEPRECATED_INTERFACES
https://bugzilla.tianocore.org/show_bug.cgi?id=162 Update EmulatorPkg specific modules and libraries to use safe string functions in BaseLib and safe PcdSetxx() functions in PcdLib. With these updates, the define DISABLE_NEW_DEPRECATED_INTERFACES is enabled in the DSC file. Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Andrew Fish <afish@apple.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Acked-by: Jordan Justen <jordan.l.justen@intel.com> Tested-by: Andrew Fish <afish@apple.com>
Diffstat (limited to 'EmulatorPkg/Library')
-rw-r--r--EmulatorPkg/Library/SmbiosLib/SmbiosLib.c4
-rw-r--r--EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c11
2 files changed, 10 insertions, 5 deletions
diff --git a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
index 331122e200..3acbb23644 100644
--- a/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
+++ b/EmulatorPkg/Library/SmbiosLib/SmbiosLib.c
@@ -4,7 +4,7 @@
Copyright (c) 2012, Apple Inc. All rights reserved.
-Portitions Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Portitions Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
@@ -223,7 +223,7 @@ SmbiosLibUpdateUnicodeString (
if (Ascii == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- UnicodeStrToAsciiStr (String, Ascii);
+ UnicodeStrToAsciiStrS (String, Ascii, StrSize (String));
StringIndex = StringNumber;
Status = gSmbios->UpdateString (gSmbios, &SmbiosHandle, &StringIndex, Ascii);
diff --git a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c b/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c
index b7aacc851c..3a7b6d1ceb 100644
--- a/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c
+++ b/EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.c
@@ -2,7 +2,7 @@
Emulator Thunk to abstract OS services from pure EFI code
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
- Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
@@ -37,6 +37,7 @@ AddThunkProtocol (
IN BOOLEAN EmuBusDriver
)
{
+ UINTN Size;
CHAR16 *StartString;
CHAR16 *SubString;
UINTN Instance;
@@ -47,8 +48,12 @@ AddThunkProtocol (
}
Instance = 0;
- StartString = AllocatePool (StrSize (ConfigString));
- StrCpy (StartString, ConfigString);
+ Size = StrSize (ConfigString);
+ StartString = AllocatePool (Size);
+ if (StartString == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+ StrCpyS (StartString, Size / sizeof (CHAR16), ConfigString);
while (*StartString != '\0') {
//