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>
ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - (*Length) - 1;\r
}\r
\r
ControllerNameStringSize = FPDT_MAX_PERF_RECORD_SIZE - (*Length) - 1;\r
}\r
\r
- UnicodeStrToAsciiStrS(StringPtr, ComponentNameString, ControllerNameStringSize);\r
+ UnicodeStrnToAsciiStrS(StringPtr, ControllerNameStringSize - 1, ComponentNameString, ControllerNameStringSize, &ControllerNameStringSize);\r
\r
//\r
// Add a space in the end of the ControllerName\r
\r
//\r
// Add a space in the end of the ControllerName\r
AsciiStringPtr = ComponentNameString;\r
}\r
\r
AsciiStringPtr = ComponentNameString;\r
}\r
\r
- UnicodeStrToAsciiStrS(StringPtr, AsciiStringPtr, DevicePathStringSize);\r
+ UnicodeStrnToAsciiStrS(StringPtr, DevicePathStringSize - 1, AsciiStringPtr, DevicePathStringSize, &DevicePathStringSize);\r
*Length += (UINT8)DevicePathStringSize;\r
return EFI_SUCCESS;\r
}\r
*Length += (UINT8)DevicePathStringSize;\r
return EFI_SUCCESS;\r
}\r