X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdePkg%2FLibrary%2FBasePrintLib%2FPrintLibInternal.c;h=6f19b314496b4b190df386697d5e53fc5fda6080;hp=fc57255068485222fce76ea5b94b6c80d2556943;hb=701e8cc29a283d6d598695592ca2469cdacddf64;hpb=cd16355bbf3267f1ad7f678e91dc60cf31f3cb29 diff --git a/MdePkg/Library/BasePrintLib/PrintLibInternal.c b/MdePkg/Library/BasePrintLib/PrintLibInternal.c index fc57255068..6f19b31449 100644 --- a/MdePkg/Library/BasePrintLib/PrintLibInternal.c +++ b/MdePkg/Library/BasePrintLib/PrintLibInternal.c @@ -1108,7 +1108,9 @@ BasePrintLibSPrintMarker ( // ArgumentString is either null-terminated, or it contains Precision characters // for (Count = 0; - ArgumentString[Count * BytesPerArgumentCharacter] != '\0' && + (ArgumentString[Count * BytesPerArgumentCharacter] != '\0' || + (BytesPerArgumentCharacter > 1 && + ArgumentString[Count * BytesPerArgumentCharacter + 1]!= '\0')) && (Count < Precision || ((Flags & PRECISION) == 0)); Count++) { ArgumentCharacter = ((ArgumentString[Count * BytesPerArgumentCharacter] & 0xff) | ((ArgumentString[Count * BytesPerArgumentCharacter + 1]) << 8)) & ArgumentMask; @@ -1167,7 +1169,9 @@ BasePrintLibSPrintMarker ( // // Copy the string into the output buffer performing the required type conversions // - while (Index < Count && (*ArgumentString) != '\0') { + while (Index < Count && + (ArgumentString[0] != '\0' || + (BytesPerArgumentCharacter > 1 && ArgumentString[1] != '\0'))) { ArgumentCharacter = ((*ArgumentString & 0xff) | (((UINT8)*(ArgumentString + 1)) << 8)) & ArgumentMask; LengthToReturn += (1 * BytesPerOutputCharacter);