mirror of https://github.com/acidanthera/audk.git
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:
parent
aa99d36be9
commit
a7dbd2ac7b
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue