[AMD Official Use Only - General] Reviewed-by: Abner Chang <[email protected]>
> -----Original Message----- > From: Nickle Wang <[email protected]> > Sent: Friday, January 19, 2024 2:23 PM > To: [email protected] > Cc: Chang, Abner <[email protected]>; Igor Kulchytskyy > <[email protected]>; Nick Ramirez <[email protected]> > Subject: [edk2-redfish-client][PATCH] > RedfishClientPkg/RedfishFeatureUtilityLib: fix wrong parameter issue > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Third parameter of AsciiStrToUnicodeStrS is the number of character in > destination buffer, not the size in byte of destination buffer. This > creates failure of converting ASCII string to Unicode string in Redfish > application while getting Location field in HTTP header. > > Signed-off-by: Nickle Wang <[email protected]> > Cc: Abner Chang <[email protected]> > Cc: Igor Kulchytskyy <[email protected]> > Cc: Nick Ramirez <[email protected]> > --- > .../RedfishFeatureUtilityLib.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib. > c > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib. > c > index a10fa4832..e14944710 100644 > --- > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib. > c > +++ > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtilityLib. > c > @@ -355,7 +355,7 @@ StrUnicodeToAscii ( > > Status = UnicodeStrToAsciiStrS (UnicodeStr, AsciiStr, AsciiStrSize); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "UnicodeStrToAsciiStrS failed: %r\n", Status)); > + DEBUG ((DEBUG_ERROR, "%a: UnicodeStrToAsciiStrS failed: %r\n", > __func__, Status)); > FreePool (AsciiStr); > return NULL; > } > @@ -380,21 +380,23 @@ StrAsciiToUnicode ( > { > EFI_STRING UnicodeStr; > UINTN UnicodeStrSize; > + UINTN InputStrSize; > EFI_STATUS Status; > > if (IS_EMPTY_STRING (AsciiStr)) { > return NULL; > } > > - UnicodeStrSize = (AsciiStrLen (AsciiStr) + 1) * sizeof (CHAR16); > + InputStrSize = AsciiStrSize (AsciiStr); > + UnicodeStrSize = InputStrSize * sizeof (CHAR16); > UnicodeStr = AllocatePool (UnicodeStrSize); > if (UnicodeStr == NULL) { > return NULL; > } > > - Status = AsciiStrToUnicodeStrS (AsciiStr, UnicodeStr, UnicodeStrSize); > + Status = AsciiStrToUnicodeStrS (AsciiStr, UnicodeStr, InputStrSize); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "t failed: %r\n", Status)); > + DEBUG ((DEBUG_ERROR, "%a: AsciiStrToUnicodeStrS failed: %r\n", > __func__, Status)); > FreePool (UnicodeStr); > return NULL; > } > -- > 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114030): https://edk2.groups.io/g/devel/message/114030 Mute This Topic: https://groups.io/mt/103825503/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
