From nobody Sun May 19 09:42:23 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+104848+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1684124711860427.6368526124512; Sun, 14 May 2023 21:25:11 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id a9maYY1788612xKp2U7MzNE8; Sun, 14 May 2023 21:25:11 -0700 X-Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.64]) by mx.groups.io with SMTP id smtpd.web11.80995.1684124710320876698 for ; Sun, 14 May 2023 21:25:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bp/WnGGAzglEA58Vu0r4B2Q14sviaO07CMtzxTCb8+DbTSocVaJS4kS5Ye4+F5ufTXZoVxyiau3Ej6Xyjf53oevp4VyHJoBjfIDvCcb1Nx1F/2FPLdglA4Vb1tKKp2Kbghe23JIrt0aOqZW84luGGVrKM+4vZuiiEFnMzWiUbb/ntEqWxbqmxK+G1ivGj83F2HdzMnk6qTTioLhXlVEvLx+l7G3p+T/C1mTNP7mrc2sCbaYRt6FRASkkXqXjy9Cg4b9nBAZfBuT2J9HfDlahLuB9XnxH2u8K4qhtcXnbYvU1zBhqpjemhHV/5DpHtkkwAbRCM03LknPMsUgn6LcG3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=p/mKQhPRGDJ8lXpugaY9+8NWGOazUfOM/FknoHQnCsI=; b=hHiJhSAzYv/xHeYeMfmWjbk3fnN+BYxRG0slepeukXuMQay6ctIEhve56nfelr6vojusJ0CnC7/2vEc5jj+vy569aP0oQeb36WjuVuSJ8kBJ9q4QfA/2f0RFBO4npV0dFbb9SvMNbQRPErZ9mVbljHRjRnp4KNdo8c+9N/yRQLN0mREDgyOAFVy8b4RGQn9WuZ5uyKZTYkMkXqOGoYjDYWtEmx0S36vj7XN/OcPBr/v0+zB8jn1EQfWB0bwwel6X/BpVeKfq1O8In1todQhPjJ5Km80f37ey+QX/gKty0R1Ez8hahxvpOiEOGQJiAeHDOpq3X8fCGHpNb/fMsQDt3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none X-Received: from MW4PR04CA0384.namprd04.prod.outlook.com (2603:10b6:303:81::29) by MN0PR12MB5979.namprd12.prod.outlook.com (2603:10b6:208:37e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Mon, 15 May 2023 04:25:07 +0000 X-Received: from CO1NAM11FT014.eop-nam11.prod.protection.outlook.com (2603:10b6:303:81:cafe::a) by MW4PR04CA0384.outlook.office365.com (2603:10b6:303:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.30 via Frontend Transport; Mon, 15 May 2023 04:25:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+104848+1787277+3901457@groups.io; helo=mail02.groups.io; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.160) by CO1NAM11FT014.mail.protection.outlook.com (10.13.175.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.14 via Frontend Transport; Mon, 15 May 2023 04:25:07 +0000 X-Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sun, 14 May 2023 21:24:57 -0700 X-Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sun, 14 May 2023 21:24:56 -0700 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.12) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Sun, 14 May 2023 21:24:55 -0700 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy Subject: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: Fix string assert issue Date: Mon, 15 May 2023 12:24:55 +0800 Message-ID: <20230515042455.4727-1-nicklew@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT014:EE_|MN0PR12MB5979:EE_ X-MS-Office365-Filtering-Correlation-Id: 9e99bbbc-e6c0-4544-07ff-08db54fc5d2a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: HMwg5DPhKKCaIteRAbhTNgtc4riShrqqnbZV42CER95vrHB/PUDbfeidVPvysuV47XGCJkUwWH2YePrVS7OBI4r88IA1Pf+hKggA55UlWdAuupYjAHtc1NUelCEIqawksLzzwjBCh+xtZFmt403cjtzYxh3gddGMMbZXClQGLIPnBNbIJujD9eWTFnU0iFkm2FSoYtajhsIbnKmKaJDPg456eO6PM8jImM2aHq8kyNhtvgWO2EZXAqPdlGPLbHiaGhzUwqbdhh0iZ8COFoyW2jXjhQFsDjLhyWvjrk/NFkRbeEm1Fi5ledJ9OSI4FTo6nyGhihhItkfGb5nuCmDqrZVG03rxwDPPa/hzkocrQxMhhVEpvRLxA8CDl018IClKJxvMIKlQh3Mctd6P2WuFLb32/LvwpAyZKlLVUBdQPYm2pRbm+AYEhhj0vbYV70oRGXfvCdeoWRUs8wyJ8YEaADeQFMrRh0EMg9pkolxQLTh18sxBFWfhLo8HHffmBm5Ytu8nxbONDHxzHKeG39gITd1NcHwqpi882LhOmI0s4URgIv10H/28S8R1qQ/nci0/m7M4/jiGbCUoi+8xrciKgDqiOq8ofclHk3/vNY10bx3jMe9WfQiTkRiHZZevxjoGZv+x8jAnQkJwzqvKOpwetwc1v9nqEyYn5mR9zsXTG3fdcmlxkUX8cJxPYYljw2YvweMaj0KcZj8yWrTRrfz0ug== X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2023 04:25:07.3647 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e99bbbc-e6c0-4544-07ff-08db54fc5d2a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT014.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5979 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,nicklew@nvidia.com X-Gm-Message-State: jpK1uVc3wRjch8IWNjkXFrwrx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1684124711; bh=hHdIasAmUvvG1CB8bHOWBTTBRPEJSn1fRInLzuGbytY=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=odu/dwMeYYN8H33ogOTYkWMOwbACV3lidWPcDGdTfY1yVEJxKU2fSgb4rFP9BW7RWPC h659DQXwTwWHyGzwCdHh1t0vApjGu4k9SWXbDdKnwP3D0PwBIHX5AkW5rZb1Q4Anr6EyQ RwNg9bqDW9NKZL9VRVtZ4heabP3cMULvj2U= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1684124712899100001 Content-Type: text/plain; charset="utf-8" When calling SetValue() with string type input, there is assertion of providing zero string ID to HII string function. Fix this issue by creating string ID for input string buffer. Fix Unicode and Ascii code convert issue together. Add text op-code support Signed-off-by: Nickle Wang Cc: Abner Chang Cc: Igor Kulchytskyy Reviewed-by: Abner Chang Reviewed-by: Igor Kulchytskyy --- .../RedfishPlatformConfigDxe.h | 14 +++ .../RedfishPlatformConfigImpl.h | 16 +++ .../RedfishPlatformConfigDxe.c | 116 ++++++++++++++++-- .../RedfishPlatformConfigImpl.c | 50 +++++--- 4 files changed, 169 insertions(+), 27 deletions(-) diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h= b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h index 67697ecda787..c86bc6e9ce2d 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.h @@ -78,4 +78,18 @@ typedef struct { #define REDFISH_PLATFORM_CONFIG_DEBUG DEBUG_VERBOSE #define REDFISH_MENU_PATH_SIZE 8 =20 +/** + Convert input unicode string to ascii string. It's caller's + responsibility to free returned buffer using FreePool(). + + @param[in] UnicodeString Unicode string to be converted. + + @retval CHAR8 * Ascii string on return. + +**/ +CHAR8 * +StrToAsciiStr ( + IN EFI_STRING UnicodeString + ); + #endif diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.= h b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h index 9ef032748663..9f4312decf50 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.h @@ -250,6 +250,22 @@ ProcessPendingList ( IN LIST_ENTRY *PendingList ); =20 +/** + Delete a string from HII Package List by given HiiHandle. + + @param[in] StringId Id of the string in HII database. + @param[in] HiiHandle The HII package list handle. + + @retval EFI_SUCCESS The string was deleted successfully. + @retval EFI_INVALID_PARAMETER StringId is zero. + +**/ +EFI_STATUS +HiiDeleteString ( + IN EFI_STRING_ID StringId, + IN EFI_HII_HANDLE HiiHandle + ); + /** Retrieves a unicode string from a string package in a given language. The returned string is allocated using AllocatePool(). The caller is respon= sible diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c= b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c index d3902f4127c1..1172d1094b06 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c @@ -1172,6 +1172,7 @@ HiiValueToRedfishValue ( UINTN Index; UINTN Count; EFI_STRING_ID *StringIdArray; + CHAR8 NullChar; =20 if ((HiiHandle =3D=3D NULL) || (HiiStatement =3D=3D NULL) || (Value =3D= =3D NULL) || (RedfishValue =3D=3D NULL) || IS_EMPTY_STRING (FullSchema)) { return EFI_INVALID_PARAMETER; @@ -1180,6 +1181,7 @@ HiiValueToRedfishValue ( StringIdArray =3D NULL; Count =3D 0; Status =3D EFI_SUCCESS; + NullChar =3D '\0'; =20 switch (HiiStatement->Operand) { case EFI_IFR_ONE_OF_OP: @@ -1205,9 +1207,18 @@ HiiValueToRedfishValue ( break; } =20 - RedfishValue->Type =3D RedfishValueTypeString; - RedfishValue->Value.Buffer =3D AllocatePool (StrLen ((CHAR16 *)Value= ->Buffer) + 1); - UnicodeStrToAsciiStrS ((CHAR16 *)Value->Buffer, RedfishValue->Value.= Buffer, StrLen ((CHAR16 *)Value->Buffer) + 1); + if (Value->Buffer =3D=3D NULL) { + RedfishValue->Value.Buffer =3D AllocateCopyPool (sizeof (NullChar)= , &NullChar); + } else { + RedfishValue->Value.Buffer =3D StrToAsciiStr ((EFI_STRING)Value->B= uffer); + } + + if (RedfishValue->Value.Buffer =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + break; + } + + RedfishValue->Type =3D RedfishValueTypeString; break; case EFI_IFR_CHECKBOX_OP: case EFI_IFR_NUMERIC_OP: @@ -1256,6 +1267,30 @@ HiiValueToRedfishValue ( =20 FreePool (StringIdArray); break; + case EFI_IFR_TEXT_OP: + // + // Use text two as the value + // + if (HiiStatement->ExtraData.TextTwo =3D=3D 0x00) { + Status =3D EFI_NOT_FOUND; + break; + } + + RedfishValue->Value.Buffer =3D HiiGetRedfishAsciiString (HiiHandle, = FullSchema, HiiStatement->ExtraData.TextTwo); + if (RedfishValue->Value.Buffer =3D=3D NULL) { + // + // No x-uefi-redfish string defined. Try to get string in English. + // + RedfishValue->Value.Buffer =3D HiiGetEnglishAsciiString (HiiHandle= , HiiStatement->ExtraData.TextTwo); + } + + if (RedfishValue->Value.Buffer =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + break; + } + + RedfishValue->Type =3D RedfishValueTypeString; + break; default: DEBUG ((DEBUG_ERROR, "%a: catch unsupported type: 0x%x! Please conta= ct with author if we need to support this type.\n", __func__, HiiStatement-= >Operand)); ASSERT (FALSE); @@ -1284,7 +1319,7 @@ StrToUnicodeStr ( EFI_STRING Buffer; EFI_STATUS Status; =20 - if ((AsciiString =3D=3D NULL) || (AsciiString[0] =3D=3D '\0')) { + if (AsciiString =3D=3D NULL) { return NULL; } =20 @@ -1303,6 +1338,43 @@ StrToUnicodeStr ( return Buffer; } =20 +/** + Convert input unicode string to ascii string. It's caller's + responsibility to free returned buffer using FreePool(). + + @param[in] UnicodeString Unicode string to be converted. + + @retval CHAR8 * Ascii string on return. + +**/ +CHAR8 * +StrToAsciiStr ( + IN EFI_STRING UnicodeString + ) +{ + UINTN StringLen; + CHAR8 *Buffer; + EFI_STATUS Status; + + if (UnicodeString =3D=3D NULL) { + return NULL; + } + + StringLen =3D StrLen (UnicodeString) + 1; + Buffer =3D AllocatePool (StringLen * sizeof (CHAR8)); + if (Buffer =3D=3D NULL) { + return NULL; + } + + Status =3D UnicodeStrToAsciiStrS (UnicodeString, Buffer, StringLen); + if (EFI_ERROR (Status)) { + FreePool (Buffer); + return NULL; + } + + return Buffer; +} + /** Return the full Redfish schema string from the given Schema and Version. =20 @@ -1641,6 +1713,17 @@ RedfishPlatformConfigSetStatementCommon ( } } =20 + if ((TargetStatement->HiiStatement->Operand =3D=3D EFI_IFR_STRING_OP) &&= (StatementValue->Type =3D=3D EFI_IFR_TYPE_STRING)) { + // + // Create string ID for new string. + // + StatementValue->Value.string =3D HiiSetString (TargetStatement->Parent= Form->ParentFormset->HiiHandle, 0x00, (EFI_STRING)StatementValue->Buffer, N= ULL); + if (StatementValue->Value.string =3D=3D 0) { + DEBUG ((DEBUG_ERROR, "%a: can not create string id\n", __func__)); + return EFI_OUT_OF_RESOURCES; + } + } + Status =3D RedfishPlatformConfigSaveQuestionValue ( TargetStatement->ParentForm->ParentFormset->HiiFormSet, TargetStatement->ParentForm->HiiForm, @@ -1649,10 +1732,13 @@ RedfishPlatformConfigSetStatementCommon ( ); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: failed to save question value: %r\n", __func= __, Status)); - return Status; } =20 - return EFI_SUCCESS; + if (StatementValue->Value.string !=3D 0) { + HiiDeleteString (StatementValue->Value.string, TargetStatement->Parent= Form->ParentFormset->HiiHandle); + } + + return Status; } =20 /** @@ -1712,9 +1798,14 @@ RedfishPlatformConfigProtocolSetValue ( =20 break; case RedfishValueTypeString: + if (Value.Value.Buffer =3D=3D NULL) { + Status =3D EFI_INVALID_PARAMETER; + goto RELEASE_RESOURCE; + } + NewValue.Type =3D EFI_IFR_TYPE_STRING; - NewValue.BufferLen =3D (UINT16)AsciiStrSize (Value.Value.Buffer); - NewValue.Buffer =3D AllocateCopyPool (NewValue.BufferLen, Value.V= alue.Buffer); + NewValue.BufferLen =3D (UINT16)(AsciiStrSize (Value.Value.Buffer) * = sizeof (CHAR16)); + NewValue.Buffer =3D (UINT8 *)StrToUnicodeStr (Value.Value.Buffer); if (NewValue.Buffer =3D=3D NULL) { Status =3D EFI_OUT_OF_RESOURCES; goto RELEASE_RESOURCE; @@ -1742,6 +1833,10 @@ RELEASE_RESOURCE: FreePool (FullSchema); } =20 + if ((Value.Type =3D=3D RedfishValueTypeString) && (NewValue.Buffer !=3D = NULL)) { + FreePool (NewValue.Buffer); + } + return Status; } =20 @@ -1784,6 +1879,7 @@ RedfishPlatformConfigProtocolGetConfigureLang ( return EFI_INVALID_PARAMETER; } =20 + ZeroMem (&StatementList, sizeof (StatementList)); *Count =3D 0; *ConfigureLangList =3D NULL; FullSchema =3D NULL; @@ -1849,7 +1945,9 @@ RELEASE_RESOURCE: FreePool (FullSchema); } =20 - ReleaseStatementList (&StatementList); + if (StatementList.Count > 0) { + ReleaseStatementList (&StatementList); + } =20 return Status; } diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.= c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c index 889448fe3870..e4a905aec44e 100644 --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigImpl.c @@ -143,6 +143,34 @@ DumpFormsetList ( return EFI_SUCCESS; } =20 +/** + Delete a string from HII Package List by given HiiHandle. + + @param[in] StringId Id of the string in HII database. + @param[in] HiiHandle The HII package list handle. + + @retval EFI_SUCCESS The string was deleted successfully. + @retval EFI_INVALID_PARAMETER StringId is zero. + +**/ +EFI_STATUS +HiiDeleteString ( + IN EFI_STRING_ID StringId, + IN EFI_HII_HANDLE HiiHandle + ) +{ + CHAR16 NullChar; + + if (StringId =3D=3D 0x00) { + return EFI_INVALID_PARAMETER; + } + + NullChar =3D CHAR_NULL; + HiiSetString (HiiHandle, StringId, &NullChar, NULL); + + return EFI_SUCCESS; +} + /** Retrieves a unicode string from a string package in a given language. The returned string is allocated using AllocatePool(). The caller is respon= sible @@ -259,7 +287,6 @@ HiiGetRedfishAsciiString ( ) { EFI_STRING HiiString; - UINTN StringSize; CHAR8 *AsciiString; =20 HiiString =3D HiiGetRedfishString (HiiHandle, Language, StringId); @@ -268,15 +295,9 @@ HiiGetRedfishAsciiString ( return NULL; } =20 - StringSize =3D (StrLen (HiiString) + 1) * sizeof (CHAR8); - AsciiString =3D AllocatePool (StringSize); - if (AsciiString =3D=3D NULL) { - return NULL; - } - - UnicodeStrToAsciiStrS (HiiString, AsciiString, StringSize); - + AsciiString =3D StrToAsciiStr (HiiString); FreePool (HiiString); + return AsciiString; } =20 @@ -322,7 +343,6 @@ HiiGetEnglishAsciiString ( ) { EFI_STRING HiiString; - UINTN StringSize; CHAR8 *AsciiString; =20 HiiString =3D HiiGetRedfishString (HiiHandle, ENGLISH_LANGUAGE_CODE, Str= ingId); @@ -331,15 +351,9 @@ HiiGetEnglishAsciiString ( return NULL; } =20 - StringSize =3D (StrLen (HiiString) + 1) * sizeof (CHAR8); - AsciiString =3D AllocatePool (StringSize); - if (AsciiString =3D=3D NULL) { - return NULL; - } - - UnicodeStrToAsciiStrS (HiiString, AsciiString, StringSize); - + AsciiString =3D StrToAsciiStr (HiiString); FreePool (HiiString); + return AsciiString; } =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#104848): https://edk2.groups.io/g/devel/message/104848 Mute This Topic: https://groups.io/mt/98897203/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-