From 9b2c125357bd6f9e95d2c40cf2eb511b5ce479cf Mon Sep 17 00:00:00 2001 From: Steve Lee Date: Tue, 28 Feb 2023 17:24:31 -0800 Subject: [PATCH] Fix `VtSubstring` helper method to correctly check chars copied (#19240) --- src/System.Management.Automation/utils/StringUtil.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/System.Management.Automation/utils/StringUtil.cs b/src/System.Management.Automation/utils/StringUtil.cs index 6bdedd03a3..8daf31866d 100644 --- a/src/System.Management.Automation/utils/StringUtil.cs +++ b/src/System.Management.Automation/utils/StringUtil.cs @@ -202,7 +202,7 @@ namespace System.Management.Automation.Internal } // If the number of copied non-escape-sequence characters has reached the specified length, done copying. - if (offset == length) + if (copyStarted && offset == length) { break; }