mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-11-04 05:25:45 +01:00 
			
		
		
		
	CryptoPkg/CrtLibSupport: fix strcpy
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>
This commit is contained in:
		
							parent
							
								
									03951e5645
								
							
						
					
					
						commit
						fab6285a73
					
				@ -265,6 +265,16 @@ strcspn (
 | 
				
			|||||||
  return Count;
 | 
					  return Count;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *
 | 
				
			||||||
 | 
					strcpy (
 | 
				
			||||||
 | 
					  char *restrict  strDest,
 | 
				
			||||||
 | 
					  const char      *strSource
 | 
				
			||||||
 | 
					  )
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  AsciiStrCpyS (strDest, MAX_STRING_SIZE, strSource);
 | 
				
			||||||
 | 
					  return strDest;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// -- Character Classification Routines --
 | 
					// -- Character Classification Routines --
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
 | 
				
			|||||||
@ -395,6 +395,12 @@ inet_pton   (
 | 
				
			|||||||
  void *
 | 
					  void *
 | 
				
			||||||
  );
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					char *
 | 
				
			||||||
 | 
					strcpy (
 | 
				
			||||||
 | 
					  char *restrict  strDest,
 | 
				
			||||||
 | 
					  const char      *strSource
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//
 | 
					//
 | 
				
			||||||
// Macros that directly map functions to BaseLib, BaseMemoryLib, and DebugLib functions
 | 
					// 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 memcmp(buf1, buf2, count)           (int)(CompareMem(buf1,buf2,(UINTN)(count)))
 | 
				
			||||||
#define memmove(dest, source, count)        CopyMem(dest,source,(UINTN)(count))
 | 
					#define memmove(dest, source, count)        CopyMem(dest,source,(UINTN)(count))
 | 
				
			||||||
#define strlen(str)                         (size_t)(AsciiStrnLenS(str,MAX_STRING_SIZE))
 | 
					#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 strncpy(strDest, strSource, count)  AsciiStrnCpyS(strDest,MAX_STRING_SIZE,strSource,(UINTN)count)
 | 
				
			||||||
#define strcat(strDest, strSource)          AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)
 | 
					#define strcat(strDest, strSource)          AsciiStrCatS(strDest,MAX_STRING_SIZE,strSource)
 | 
				
			||||||
#define strncmp(string1, string2, count)    (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
 | 
					#define strncmp(string1, string2, count)    (int)(AsciiStrnCmp(string1,string2,(UINTN)(count)))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user