* [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
@ 2020-06-01 21:12 Jeff Brasen
2020-06-10 6:00 ` [edk2-devel] " Dandan Bi
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Brasen @ 2020-06-01 21:12 UTC (permalink / raw)
To: devel; +Cc: dandan.bi, liming.gao, Jeff Brasen
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/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
index f500e20b32..89ae6fb964 100644
--- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
+++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS
2020-06-01 21:12 [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Jeff Brasen
@ 2020-06-10 6:00 ` Dandan Bi
0 siblings, 0 replies; 2+ messages in thread
From: Dandan Bi @ 2020-06-10 6:00 UTC (permalink / raw)
To: devel@edk2.groups.io, jbrasen@nvidia.com; +Cc: Gao, Liming
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
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-10 6:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-01 21:12 [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Jeff Brasen
2020-06-10 6:00 ` [edk2-devel] " Dandan Bi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox