strcpy() returns a pointer to the destination string, AsciiStrCpyS()
does not.  So a simple #define does not work.  Create a function
instead.

Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
Reviewed-by: Jiewen Yao <jiewen....@intel.com>
---
 CryptoPkg/Library/Include/CrtLibSupport.h           |  7 ++++++-
 CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 10 ++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h 
b/CryptoPkg/Library/Include/CrtLibSupport.h
index 287d7f76bfb3..bdc2654b6eef 100644
--- a/CryptoPkg/Library/Include/CrtLibSupport.h
+++ b/CryptoPkg/Library/Include/CrtLibSupport.h
@@ -395,6 +395,12 @@ inet_pton   (
   void *
   );
 
+char *
+strcpy (
+  char *restrict  strDest,
+  const char      *strSource
+  );
+
 //
 // Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib 
functions
 //
@@ -404,7 +410,6 @@ inet_pton   (
 #define memcmp(buf1, buf2, count)           
(int)(CompareMem(buf1,buf2,(UINTN)(count)))
 #define memmove(dest, source, count)        CopyMem(dest,source,(UINTN)(count))
 #define strlen(str)                         
(size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))
-#define strcpy(strDest, strSource)          
AsciiStrCpyS(strDest,MAX_STRING_SIZE,strSource)
 #define strncpy(strDest, strSource, count)  
AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count)
 #define strcat(strDest, strSource)          
AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)
 #define strncmp(string1, string2, count)    
(int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c 
b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
index bac477da070b..6fcbe5885e7b 100644
--- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
+++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
@@ -265,6 +265,16 @@ strcspn (
   return Count;
 }
 
+char *
+strcpy (
+  char *restrict  strDest,
+  const char      *strSource
+  )
+{
+  AsciiStrCpyS (strDest, MAX_STRING_SIZE, strSource);
+  return strDest;
+}
+
 //
 // -- Character Classification Routines --
 //
-- 
2.35.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#88699): https://edk2.groups.io/g/devel/message/88699
Mute This Topic: https://groups.io/mt/90392492/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to