Skip to content

Commit f15a8da

Browse files
IISResetMeTravisEz13
authored andcommitted
Makes Start-Trace escape file paths correctly (#3863)
Start-Trace neglects qualifying arguments to the -o and -pf command line switches, causing logman (and subsequently Start-Trace) to exit with 0x80070057 and return: Error: The argument is incorrect. Whenever arguments to either -ProviderFilePath or -OutputFilePath contain spaces because Start-Trace doesn't escape the path in any way. This commit moves basic input validation for output file paths to the ProviderFilePath and OutputFilePath parameter definitions, and adds text qualifiers (double-quotes) around input arguments
1 parent 7d5367a commit f15a8da

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Modules/Windows-Core+Full/PSDiagnostics/PSDiagnostics.psm1

+4-2
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ function Start-Trace
2727
[string]
2828
$SessionName,
2929
[Parameter(Position=1)]
30+
[ValidateNotNullOrEmpty()]
3031
[string]
3132
$OutputFilePath,
3233
[Parameter(Position=2)]
34+
[ValidateNotNullOrEmpty()]
3335
[string]
3436
$ProviderFilePath,
3537
[Parameter()]
@@ -63,12 +65,12 @@ function Start-Trace
6365

6466
if ($null -ne $OutputFilePath)
6567
{
66-
$executestring += " -o $OutputFilePath"
68+
$executestring += " -o ""$OutputFilePath"""
6769
}
6870

6971
if ($null -ne $ProviderFilePath)
7072
{
71-
$executestring += " -pf $ProviderFilePath"
73+
$executestring += " -pf ""$ProviderFilePath"""
7274
}
7375

7476
if ($null -ne $Format)

0 commit comments

Comments
 (0)