X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdeModulePkg%2FLibrary%2FDxePrintLibPrint2Protocol%2FPrintLib.c;fp=MdeModulePkg%2FLibrary%2FDxePrintLibPrint2Protocol%2FPrintLib.c;h=e09520c81b248e4f8e325a81cb6533074c649a8a;hb=b23276135a51d9d9e9973f30ff6c5014a79d5177;hp=0e6178fc9c8fe23623e4634cc635b37b3798b01d;hpb=701e8cc29a283d6d598695592ca2469cdacddf64;p=mirror_edk2.git diff --git a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c index 0e6178fc9c..e09520c81b 100644 --- a/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c +++ b/MdeModulePkg/Library/DxePrintLibPrint2Protocol/PrintLib.c @@ -2051,7 +2051,9 @@ InternalPrintLibSPrintMarker ( // 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; @@ -2110,7 +2112,9 @@ InternalPrintLibSPrintMarker ( // // 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);