From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by mx.groups.io with SMTP id smtpd.web12.868.1592850028686194227 for ; Mon, 22 Jun 2020 11:20:28 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=Bdnxi+UY; spf=pass (domain: nvidia.com, ip: 216.228.121.65, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 22 Jun 2020 11:20:15 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 22 Jun 2020 11:20:28 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 22 Jun 2020 11:20:28 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 22 Jun 2020 18:20:26 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 22 Jun 2020 18:20:26 +0000 Received: from jbrasen-ux.nvidia.com (Not Verified[10.2.52.119]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 22 Jun 2020 11:20:25 -0700 From: "Jeff Brasen" To: CC: , , Jeff Brasen Subject: [PATCH v2] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Date: Mon, 22 Jun 2020 12:20:16 -0600 Message-ID: X-Mailer: git-send-email 2.17.1 X-NVConfidentiality: public Return-Path: jbrasen@nvidia.com MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1592850015; bh=k95DUWat8zV72g6cVPUD+qPxTfyPOtzABsgNnxg6tUE=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=Bdnxi+UYQmaJiFSaQTfUKs5H4oEk3rNhGboHjt9wWTl5+vrkvfcw74b6ZJGe4MB28 bcPGCzxFBWEhEJGA4gyGJBY4QwkOhf2vIXMjVzLPzWZ6NcllbOCjCXzexYXAqt6TPF 0t/zxN0BcxrLmnLOLG1D2cSBWkZgKWegSEXbpwQ/wlk89JUvDGg6uW5B5NoEbdcM9s RRYedyTTxNurp9OsDvki4+pkrsrpAcM13oiH4000s3lewbVYqKyuGs9Efw/8N8ypUt I/uJBOT+/mEWcs9tDhKoC9xvrSoH383/Aiz4KH8QawJ6BMb9pvcZSBMls0yEmj5GlM BZXY74W40VDPw== Content-Type: text/plain 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 --- .../Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 4 ++-- 1 file 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; } -- 2.17.1