From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from hqnvemgate25.nvidia.com (hqnvemgate25.nvidia.com [216.228.121.64]) by mx.groups.io with SMTP id smtpd.web12.47979.1591045969366558955 for ; Mon, 01 Jun 2020 14:12:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nvidia.com header.s=n1 header.b=H2slugVC; spf=pass (domain: nvidia.com, ip: 216.228.121.64, mailfrom: jbrasen@nvidia.com) Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 01 Jun 2020 14:11:22 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Mon, 01 Jun 2020 14:12:49 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Mon, 01 Jun 2020 14:12:49 -0700 Received: from HQMAIL109.nvidia.com (172.20.187.15) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 1 Jun 2020 21:12:46 +0000 Received: from rnnvemgw01.nvidia.com (10.128.109.123) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 1 Jun 2020 21:12:45 +0000 Received: from jbrasen-ux.nvidia.com (Not Verified[10.2.88.96]) by rnnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 01 Jun 2020 14:12:45 -0700 From: "Jeff Brasen" To: CC: , , Jeff Brasen Subject: [PATCH] MdeModulePkg/DxeCorePerformanceLib: Switch to UnicodeStrnToAsciiStrS Date: Mon, 1 Jun 2020 15:12:37 -0600 Message-ID: <9254b0b3c07d70dffc45aa919658ee32f2f54874.1591044879.git.jbrasen@nvidia.com> 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=1591045882; bh=UBbINqWBEghPlvR8kOboEQ8qQJabe8Y7EGJ1LxeGDmc=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=H2slugVCYpdBwqp7SA8ekq46Vi7xOLcEXRELxLmTc7oQwdla7AARtvuckpx9bFoxC kSnJl2iiQXZGE2JexEnaZN58Q+KaEWjfLPQkuiGQoRboh7vyNTTsv97Gc6/vbnCGOB ZQE7WS7HNzhUyQK+Jdg07sCoHJRqvGwJgwsnnF5+pltsNLvxZIc/s0L9YsRuMZt/V+ YJzZBPb7tscPaACNCVhFs++HX4T+CUAxYdhjvpxYqWbYZftZ7n96d7gtgbDwPtaJ0E vVWkhIOlSgJlSFPIrnR5nuKa5e+F+xGDMKgTK8OZgRL4HZSyTqpBGwZQjrUFzFlFh5 hE0ZEUKxafv2w== 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 | 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