public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dandan Bi" <dandan.bi@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"jbrasen@nvidia.com" <jbrasen@nvidia.com>
Cc: "Gao, Liming" <liming.gao@intel.com>
Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
Date: Wed, 10 Jun 2020 06:00:26 +0000	[thread overview]
Message-ID: <BN6PR11MB13930F2D3BEF94348E945D7CEA830@BN6PR11MB1393.namprd11.prod.outlook.com> (raw)
In-Reply-To: <9254b0b3c07d70dffc45aa919658ee32f2f54874.1591044879.git.jbrasen@nvidia.com>

Thanks for the fix.
Could you also help update the UnicodeStrToAsciiStrS usage at line 840? Which potentially has the similar issue.
UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, ControllerNameStringSize);


Thanks,
Dandan
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jeff
> Brasen
> Sent: Tuesday, June 2, 2020 5:13 AM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan <dandan.bi@intel.com>; Gao, Liming <liming.gao@intel.com>;
> Jeff Brasen <jbrasen@nvidia.com>
> Subject: [edk2-devel] [PATCH] MdeModulePkg/DxeCorePerformanceLib:
> Switch to UnicodeStrnToAsciiStrS
> 
> UnicodeStrToAsciiStrS requires that the source string is shorter than the
> destination buffer and will ASSERT if this is not true. Switch to
> UnicodeStrnToAsciiStrS as there are cases where the source string is longer
> than the buffer allocated for the device path.
> 
> Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
> ---
>  .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c       | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> index f500e20b32..89ae6fb964 100644
> ---
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> +++
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi
> b.c
> @@ -879,7 +879,7 @@ GetDeviceInfoFromHandleAndUpdateLength (
>          AsciiStringPtr = ComponentNameString;
>        }
> 
> -      UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize);
> +      UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1,
> + AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize);
>        *Length += (UINT8)DevicePathStringSize;
>        return EFI_SUCCESS;
>      }
> --
> 2.17.1
> 
> 
> 


      reply	other threads:[~2020-06-10  6:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-01 21:12 [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Jeff Brasen
2020-06-10  6:00 ` Dandan Bi [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=BN6PR11MB13930F2D3BEF94348E945D7CEA830@BN6PR11MB1393.namprd11.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