CryptoPkg: Fix strncpy for BaseCryptLibMbedTls

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2817

Because the change for strncpy, add the strncpy implementation.

Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
This commit is contained in:
Wenxing Hou 2024-06-14 10:52:59 +08:00 committed by mergify[bot]
parent aa99d36be9
commit a7dbd2ac7b
1 changed files with 22 additions and 3 deletions

View File

@ -258,9 +258,28 @@ strcpy (
const char *strSource const char *strSource
) )
{ {
// AsciiStrCpyS (strDest, MAX_STRING_SIZE, strSource); AsciiStrCpyS (strDest, AsciiStrnSizeS (strSource, MAX_STRING_SIZE - 1), strSource);
// return strDest; return strDest;
return NULL; }
char *
strncpy (
char *strDest,
const char *strSource,
size_t count
)
{
UINTN DestMax = MAX_STRING_SIZE;
if (count < MAX_STRING_SIZE) {
DestMax = count + 1;
} else {
count = MAX_STRING_SIZE-1;
}
AsciiStrnCpyS (strDest, DestMax, strSource, (UINTN)count);
return strDest;
} }
// //