summaryrefslogtreecommitdiff
path: root/CryptoPkg
diff options
context:
space:
mode:
authorQin Long <qin.long@intel.com>2015-09-02 08:12:39 +0000
committerlgao4 <lgao4@Edk2>2015-09-02 08:12:39 +0000
commit5c4a3795a54d6c7b0912111b39add48ba7b59fee (patch)
treef6fb036aac2fd83e2a5b15cce6ef24fc133f882c /CryptoPkg
parent01097ae1c22a88bf9a7f23a4b10f3a26ab2137f2 (diff)
downloadedk2-platforms-5c4a3795a54d6c7b0912111b39add48ba7b59fee.tar.xz
CryptoPkg: Replace string wrapper functions with safe string functions
EDKII core suggests to retire unsafe string functions. This patch is to replace string wrapper functions with new-added safe string functions for consistency. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qin Long <qin.long@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18385 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'CryptoPkg')
-rw-r--r--CryptoPkg/Include/OpenSslSupport.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/CryptoPkg/Include/OpenSslSupport.h b/CryptoPkg/Include/OpenSslSupport.h
index b5a8b58148..2c6e23cee3 100644
--- a/CryptoPkg/Include/OpenSslSupport.h
+++ b/CryptoPkg/Include/OpenSslSupport.h
@@ -21,6 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/MemoryAllocationLib.h>
#include <Library/DebugLib.h>
+#define MAX_STRING_SIZE 0x1000
+
//
// File operations are not required for building Open SSL,
// so FILE is mapped to VOID * to pass build
@@ -236,10 +238,10 @@ extern FILE *stdout;
#define memmove(dest,source,count) CopyMem(dest,source,(UINTN)(count))
#define strcmp AsciiStrCmp
#define strncmp(string1,string2,count) (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
-#define strcpy(strDest,strSource) AsciiStrCpy(strDest,strSource)
-#define strncpy(strDest,strSource,count) AsciiStrnCpy(strDest,strSource,(UINTN)count)
-#define strlen(str) (size_t)(AsciiStrLen(str))
-#define strcat(strDest,strSource) AsciiStrCat(strDest,strSource)
+#define strcpy(strDest,strSource) AsciiStrCpyS(strDest,MAX_STRING_SIZE,strSource)
+#define strncpy(strDest,strSource,count) AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count)
+#define strlen(str) (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))
+#define strcat(strDest,strSource) AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)
#define strchr(str,ch) ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)
#define abort() ASSERT (FALSE)
#define assert(expression)