]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg: Replace string wrapper functions with safe string functions
authorQin Long <qin.long@intel.com>
Wed, 2 Sep 2015 08:12:39 +0000 (08:12 +0000)
committerlgao4 <lgao4@Edk2>
Wed, 2 Sep 2015 08:12:39 +0000 (08:12 +0000)
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

CryptoPkg/Include/OpenSslSupport.h

index b5a8b58148ccafe9269445de8e07d061645db8bd..2c6e23cee3fed473839fc488d39778fb07fcf4ca 100644 (file)
@@ -21,6 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/MemoryAllocationLib.h>\r
 #include <Library/DebugLib.h>\r
 \r
+#define MAX_STRING_SIZE  0x1000\r
+\r
 //\r
 // File operations are not required for building Open SSL, \r
 // so FILE is mapped to VOID * to pass build\r
@@ -236,10 +238,10 @@ extern FILE  *stdout;
 #define memmove(dest,source,count)        CopyMem(dest,source,(UINTN)(count))\r
 #define strcmp                            AsciiStrCmp\r
 #define strncmp(string1,string2,count)    (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))\r
-#define strcpy(strDest,strSource)         AsciiStrCpy(strDest,strSource)\r
-#define strncpy(strDest,strSource,count)  AsciiStrnCpy(strDest,strSource,(UINTN)count)\r
-#define strlen(str)                       (size_t)(AsciiStrLen(str))\r
-#define strcat(strDest,strSource)         AsciiStrCat(strDest,strSource)\r
+#define strcpy(strDest,strSource)         AsciiStrCpyS(strDest,MAX_STRING_SIZE,strSource)\r
+#define strncpy(strDest,strSource,count)  AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count)\r
+#define strlen(str)                       (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))\r
+#define strcat(strDest,strSource)         AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)\r
 #define strchr(str,ch)                    ScanMem8((VOID *)(str),AsciiStrSize(str),(UINT8)ch)\r
 #define abort()                           ASSERT (FALSE)\r
 #define assert(expression)\r