Revision: 18397
          http://sourceforge.net/p/edk2/code/18397
Author:   vanjeff
Date:     2015-09-05 02:19:06 +0000 (Sat, 05 Sep 2015)
Log Message:
-----------
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.

(Sync patch r18385 from main trunk.)

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.l...@intel.com>
Reviewed-by: Eric Dong <eric.d...@intel.com>

Revision Links:
--------------
    http://sourceforge.net/p/edk2/code/18385

Modified Paths:
--------------
    branches/UDK2015/CryptoPkg/Include/OpenSslSupport.h

Modified: branches/UDK2015/CryptoPkg/Include/OpenSslSupport.h
===================================================================
--- branches/UDK2015/CryptoPkg/Include/OpenSslSupport.h 2015-09-05 02:07:02 UTC 
(rev 18396)
+++ branches/UDK2015/CryptoPkg/Include/OpenSslSupport.h 2015-09-05 02:19:06 UTC 
(rev 18397)
@@ -21,6 +21,8 @@
 #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 @@
 #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)


------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to