From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id BE5F2D8024A for ; Fri, 19 Jan 2024 06:23:26 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=313mJH9fbLvear5emKyPz31ZPo9suG4wAueswjc7mzk=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Received-SPF:From:To:CC:Subject:Date:Message-ID:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding:Content-Type; s=20140610; t=1705645405; v=1; b=a0J57GHBbYA0L4WxmDUdYQ1sx8dKbEaILUHaMzxe7gUF5FGOlNXhM8kODISLcAiaO7JdpAkU oxRetgK8YcAshtJBmoaQa4FTjgbVLrK4ymCkqwXKtwpUgtCYL8dzlux55e7SjAgxi4LmS57M9rH E7LlJ0Qne5Z4dS9zfnoXEeoc= X-Received: by 127.0.0.2 with SMTP id CQq8YY7687511xwN9AtgQiE5; Thu, 18 Jan 2024 22:23:25 -0800 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.46]) by mx.groups.io with SMTP id smtpd.web10.16064.1705645404556268849 for ; Thu, 18 Jan 2024 22:23:24 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SQDy9hVBd7Fuxnrnrfe0n+sXwF09h1RqZ4Mg8WJNjR4l7dKu+rEmDJUkVgO9ELW38C++jHg/CQoaEq6MwOqvh8tc+eeEbUoaBqUIGbUP8lVRAikw6I/YY7hh4ZFYuwgNOsD6Fgtg82PR3C36z+lJIEfYIQ6sfbZbZAo/l83I4tB82z2iRf72d5KXAsrRspsXQWyVnhlWQAM7aQxmgbYuHLeC87HuSANiryE2+he8Cbp/chnWsaC6aiwclqz87zN9s+a4dxbn/r1+uolBGQ4pSWjlOckJVzbp7YOiYmNukXmQl67KH4DUBVR4wOlQ4WVAEPZQ3EE4Sf09MENcJpOBwA== 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=FCItbDVzhGK9799W8DSe+qH4mQlGcMiZ8++7x9Q4t24=; b=iHbl3JSpIAr6jPav8Mis25jfxHjI852tQY2qjfyIaR1tccR6gGGSM97KN7vSszFnkaOoxvi7Cc5k9LZkY5Z54YHuiYO25kSxzCMt+GeD2YF7C00bvM8JMVElMZtKSHsePdPg8oftTbtZGVTLLxtorNHBDuxsUdAvLsrTbEUtcC6cW3uhu1gEkbhEL1he3blG5rtYbGtY9oVtsvlhr9EL9qZtAiGtPZfcIIW9Szx4qAAaD7WqQfdBU4A5CGcHfkMJA0yBqZrUNRBCwIlA3nsqIjAdvC4rkVReNSe4hxrkC0zY81YWy2ytQObUYMrOQSPuMEMWLtLlHaBjzcGSPlzspw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) 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 (0) X-Received: from MN2PR02CA0026.namprd02.prod.outlook.com (2603:10b6:208:fc::39) by DM4PR12MB5229.namprd12.prod.outlook.com (2603:10b6:5:398::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24; Fri, 19 Jan 2024 06:23:21 +0000 X-Received: from MN1PEPF0000F0E2.namprd04.prod.outlook.com (2603:10b6:208:fc:cafe::3f) by MN2PR02CA0026.outlook.office365.com (2603:10b6:208:fc::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.24 via Frontend Transport; Fri, 19 Jan 2024 06:23:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C X-Received: from mail.nvidia.com (216.228.117.161) by MN1PEPF0000F0E2.mail.protection.outlook.com (10.167.242.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Fri, 19 Jan 2024 06:23:20 +0000 X-Received: from rnnvmail205.nvidia.com (10.129.68.10) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 18 Jan 2024 22:23:07 -0800 X-Received: from rnnvmail202.nvidia.com (10.129.68.7) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 18 Jan 2024 22:23:06 -0800 X-Received: from NV-CL38DL3.nvidia.com (10.127.8.13) by mail.nvidia.com (10.129.68.7) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Thu, 18 Jan 2024 22:23:05 -0800 From: "Nickle Wang via groups.io" To: CC: Abner Chang , Igor Kulchytskyy , "Nick Ramirez" Subject: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/RedfishFeatureUtilityLib: fix wrong parameter issue Date: Fri, 19 Jan 2024 14:23:05 +0800 Message-ID: <20240119062305.5208-1-nicklew@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000F0E2:EE_|DM4PR12MB5229:EE_ X-MS-Office365-Filtering-Correlation-Id: 1175f689-8253-41da-6200-08dc18b7221c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Message-Info: vhMRsgrkTdzoO2cKCZRFtdX3BLpnYfYKnxLhSJgu6AQHNgIV0KoxGXQtqo5yHUSKnQwC5dx1g8qqsSMfarK7nnjLz348UBWR8/Co+x+nlL4KHel187uDBLjp0uvmPic0UPbRvIKTGYX/FGRyolPevXKurqm8+ylBDRrvxZAqMbgyQ3qp8XDVN41z+TzshkwbD4llI7049oWQdTC4I5kivUjlqbHEC4+FhT2ML7DYE0aRO4iqyjcZXfN+I9iYNxRa3EIdXkfk81e/SwWgs6vsdGBfy9EMrYkuOYser277tcBdisbqq8kHV5euZdJ0pNrelFpZcWuFCTt5i8zxofktqhWCMfqiqs8lfJa+TCQX4s65EYTezEsRO0x7aiiQo5aho3LbfpiSy7GC7b4M2nPXKwQ6PD6FDpiXB8JsiJxVDFlGRfcJysdWp5MicA41KFbfNcedJRmODQd5zkpkzpsrphaWDxoqRH3EF/jwwCHLkVxHAvUjFr5a7NSwQZucRCMI/X0Z519cRH0FpBuchniDtMNivHIIJ4YLmoRhQKB5SLitbQFAfu6/4yUpUCDYiT4u4lhKZc14IcQbcveeaIOeZ9CW7JVktJTxnoVlahD0N0uchcx9DEj6TDn1cz5kPYf/qADef59DPK4DATFHDVXxBNCasrcDS5G2OPxQppjnNvVJes+dNqmFVSc8wbgNkE+QSEXy1o7E9+QSW/QiDrkH7FxdqkBqeHgoE+foxbM4hNK1tnHSG2/C6KJ3EOEg4UD3 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2024 06:23:20.8103 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1175f689-8253-41da-6200-08dc18b7221c 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.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: MN1PEPF0000F0E2.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5229 Precedence: Bulk 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 List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 6MXkIY2OpQDKTJGIcgFDimfkx7686176AA= Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=a0J57GHB; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") 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 Cc: Abner Chang Cc: Igor Kulchytskyy Cc: Nick Ramirez --- .../RedfishFeatureUtilityLib.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatu= reUtilityLib.c b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishF= eatureUtilityLib.c index a10fa4832..e14944710 100644 --- a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtili= tyLib.c @@ -355,7 +355,7 @@ StrUnicodeToAscii ( =20 Status =3D 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; =20 if (IS_EMPTY_STRING (AsciiStr)) { return NULL; } =20 - UnicodeStrSize =3D (AsciiStrLen (AsciiStr) + 1) * sizeof (CHAR16); + InputStrSize =3D AsciiStrSize (AsciiStr); + UnicodeStrSize =3D InputStrSize * sizeof (CHAR16); UnicodeStr =3D AllocatePool (UnicodeStrSize); if (UnicodeStr =3D=3D NULL) { return NULL; } =20 - Status =3D AsciiStrToUnicodeStrS (AsciiStr, UnicodeStr, UnicodeStrSize); + Status =3D 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; } --=20 2.34.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 (#114028): https://edk2.groups.io/g/devel/message/114028 Mute This Topic: https://groups.io/mt/103825503/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-