Revision: 18385
          http://sourceforge.net/p/edk2/code/18385
Author:   lgao4
Date:     2015-09-02 08:12:39 +0000 (Wed, 02 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.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <[email protected]>
Reviewed-by: Eric Dong <[email protected]>

Modified Paths:
--------------
    trunk/edk2/CryptoPkg/Include/OpenSslSupport.h

Modified: trunk/edk2/CryptoPkg/Include/OpenSslSupport.h
===================================================================
--- trunk/edk2/CryptoPkg/Include/OpenSslSupport.h       2015-09-02 07:40:21 UTC 
(rev 18384)
+++ trunk/edk2/CryptoPkg/Include/OpenSslSupport.h       2015-09-02 08:12:39 UTC 
(rev 18385)
@@ -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)


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to