public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: Nickle Wang <nicklew@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Igor Kulchytskyy <igork@ami.com>, Nick Ramirez <nramirez@nvidia.com>
Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/RedfishFeatureUtilityLib: fix wrong parameter issue
Date: Fri, 19 Jan 2024 08:21:58 +0000	[thread overview]
Message-ID: <LV8PR12MB9452523AB79AF18F6DCE142AEA702@LV8PR12MB9452.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20240119062305.5208-1-nicklew@nvidia.com>

[AMD Official Use Only - General]

Reviewed-by: Abner Chang <abner.chang@amd.com>

> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Friday, January 19, 2024 2:23 PM
> To: devel@edk2.groups.io
> Cc: Chang, Abner <Abner.Chang@amd.com>; Igor Kulchytskyy
> <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> 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 <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  .../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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



      reply	other threads:[~2024-01-19  8:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19  6:23 [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/RedfishFeatureUtilityLib: fix wrong parameter issue Nickle Wang via groups.io
2024-01-19  8:21 ` Chang, Abner via groups.io [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=LV8PR12MB9452523AB79AF18F6DCE142AEA702@LV8PR12MB9452.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox