diff --git a/MdePkg/Library/BaseLib/SafeString.c b/MdePkg/Library/BaseLib/SafeString.c index 29310889ca..417497cbc9 100644 --- a/MdePkg/Library/BaseLib/SafeString.c +++ b/MdePkg/Library/BaseLib/SafeString.c @@ -2932,7 +2932,7 @@ AsciiStrToUnicodeStrS ( // Convert string // while (*Source != '\0') { - *(Destination++) = (CHAR16)*(Source++); + *(Destination++) = (CHAR16)(UINT8)*(Source++); } *Destination = '\0'; @@ -3045,7 +3045,7 @@ AsciiStrnToUnicodeStrS ( // Convert string // while ((*Source != 0) && (SourceLen > 0)) { - *(Destination++) = (CHAR16)*(Source++); + *(Destination++) = (CHAR16)(UINT8)*(Source++); SourceLen--; (*DestinationLength)++; } diff --git a/MdePkg/Library/BaseLib/String.c b/MdePkg/Library/BaseLib/String.c index cb90774c86..e6df12797d 100644 --- a/MdePkg/Library/BaseLib/String.c +++ b/MdePkg/Library/BaseLib/String.c @@ -1746,7 +1746,7 @@ AsciiStrToUnicodeStr ( ReturnValue = Destination; while (*Source != '\0') { - *(Destination++) = (CHAR16) *(Source++); + *(Destination++) = (CHAR16)(UINT8) *(Source++); } // // End the Destination with a NULL.