Skip to content

Commit 8b6a673

Browse files
Copilotdmichon-msft
andcommitted
Add validation to ensure endIndex > startIndex for robust parsing
Co-authored-by: dmichon-msft <26827560+dmichon-msft@users.noreply.github.com>
1 parent 68a2f2a commit 8b6a673

File tree

1 file changed

+1
-1
lines changed
  • vscode-extensions/debug-certificate-manager-vscode-extension/src

1 file changed

+1
-1
lines changed

vscode-extensions/debug-certificate-manager-vscode-extension/src/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ export function activate(context: vscode.ExtensionContext): void {
216216

217217
const startIndex: number = output.lastIndexOf(markerPrefix);
218218
const endIndex: number = output.lastIndexOf(markerSuffix);
219-
if (startIndex !== -1 && endIndex !== -1) {
219+
if (startIndex !== -1 && endIndex !== -1 && endIndex > startIndex) {
220220
homeDir = output.substring(startIndex + markerPrefix.length, endIndex).trim();
221221
} else {
222222
throw new Error('Failed to parse home directory from command output');

0 commit comments

Comments
 (0)