Skip to content

Fix crash if command sent to pwsh is just whitespace - #10977

Merged
Andrew (anmenaga) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:pwsh-whitespace-arg
Nov 4, 2019
Merged

Andrew (anmenaga) merged 2 commits into
PowerShell:masterfrom
SteveL-MSFT:pwsh-whitespace-arg

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Nov 2, 2019 •

Copy link
Copy Markdown
Member

PR Summary

In the early parsing code, a null switchkey can be returned. This isn't expected in later code resulting in an unhandled exception. Fix is to check if switchkey is null before additoinal processing. In this case, just whitespace is sent to PowerShell whereas an empty string returns an error.

PR Context

Fix #10975

PR Checklist

@daxian-dbw Dongbo Wang (daxian-dbw) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@anmenaga Andrew (anmenaga) added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Nov 4, 2019
@anmenaga Andrew (anmenaga) added this to the 7.0.0-preview.6 milestone Nov 4, 2019
@anmenaga
Andrew (anmenaga) merged commit baf2410 into PowerShell:master Nov 4, 2019
@ghost

Copy link
Copy Markdown

🎉v7.0.0-preview.6 has been released which incorporates this pull request.:tada:

Handy links:

@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the pwsh-whitespace-arg branch June 6, 2020 02:29
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PowerShell can't handle empty commandline parameter

5 participants