mirror of https://github.com/acidanthera/audk.git
Fix a bug in MdePkg BaseLib: StrnCat() and AsciiStrnCat() should NULL terminated the final destination string when Length is equal to the length of Source string
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9588 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
8595f12dc5
commit
8f635c36ad
|
@ -425,7 +425,11 @@ StrnCat (
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
StrnCpy (Destination + StrLen (Destination), Source, Length);
|
UINTN DestinationLen;
|
||||||
|
|
||||||
|
DestinationLen = StrLen (Destination);
|
||||||
|
StrnCpy (Destination + DestinationLen, Source, Length);
|
||||||
|
Destination[DestinationLen + Length] = L'\0';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Size of the resulting string should never be zero.
|
// Size of the resulting string should never be zero.
|
||||||
|
@ -1566,7 +1570,11 @@ AsciiStrnCat (
|
||||||
IN UINTN Length
|
IN UINTN Length
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
AsciiStrnCpy (Destination + AsciiStrLen (Destination), Source, Length);
|
UINTN DestinationLen;
|
||||||
|
|
||||||
|
DestinationLen = AsciiStrLen (Destination);
|
||||||
|
AsciiStrnCpy (Destination + DestinationLen, Source, Length);
|
||||||
|
Destination[DestinationLen + Length] = '\0';
|
||||||
|
|
||||||
//
|
//
|
||||||
// Size of the resulting string should never be zero.
|
// Size of the resulting string should never be zero.
|
||||||
|
|
Loading…
Reference in New Issue