]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/CrtLibSupport: fix strcpy
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 11 Apr 2022 11:24:56 +0000 (19:24 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 12 Apr 2022 14:39:01 +0000 (14:39 +0000)
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 <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c
CryptoPkg/Library/Include/CrtLibSupport.h

index bac477da070b04be4a93b209bc0bbcf8e6e3fc69..6fcbe5885e7bf3908133d7624783e8c8a4c635c1 100644 (file)
@@ -265,6 +265,16 @@ strcspn (
   return Count;\r
 }\r
 \r
+char *\r
+strcpy (\r
+  char *restrict  strDest,\r
+  const char      *strSource\r
+  )\r
+{\r
+  AsciiStrCpyS (strDest, MAX_STRING_SIZE, strSource);\r
+  return strDest;\r
+}\r
+\r
 //\r
 // -- Character Classification Routines --\r
 //\r
index 287d7f76bfb3dbe166db73b716391b06f8a74ebf..bdc2654b6eefa4d2a13bd8a87ab72b1d69698840 100644 (file)
@@ -395,6 +395,12 @@ inet_pton   (
   void *\r
   );\r
 \r
+char *\r
+strcpy (\r
+  char *restrict  strDest,\r
+  const char      *strSource\r
+  );\r
+\r
 //\r
 // Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions\r
 //\r
@@ -404,7 +410,6 @@ inet_pton   (
 #define memcmp(buf1, buf2, count)           (int)(CompareMem(buf1,buf2,(UINTN)(count)))\r
 #define memmove(dest, source, count)        CopyMem(dest,source,(UINTN)(count))\r
 #define strlen(str)                         (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))\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 strcat(strDest, strSource)          AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)\r
 #define strncmp(string1, string2, count)    (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))\r