diff options
author | Jeff Brasen <jbrasen@nvidia.com> | 2020-06-23 02:20:16 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-07-21 14:47:24 +0000 |
commit | 9132a31b9c8381197eee75eb66c809182b264110 (patch) | |
tree | c345c7ea118576c56cb8af046f3c8363f7ec67ed /MdeModulePkg/Library | |
parent | 02539e900854488343a1efa435d4dded1ddd66a2 (diff) | |
download | edk2-9132a31b9c8381197eee75eb66c809182b264110.tar.gz |
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>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Diffstat (limited to 'MdeModulePkg/Library')
-rw-r--r-- | MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c index f500e20b32..d378c59dd9 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -837,7 +837,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - (*Length) - 1;
}
- UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, ControllerNameStringSize);
+ UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1, ComponentNameString, ControllerNameStringSize, &ControllerNameStringSize);
//
// Add a space in the end of the ControllerName
@@ -879,7 +879,7 @@ GetDeviceInfoFromHandleAndUpdateLength ( AsciiStringPtr = ComponentNameString;
}
- UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize);
+ UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1, AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize);
*Length += (UINT8)DevicePathStringSize;
return EFI_SUCCESS;
}
|