mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Blacklist control characters rather than whitelist
This commit is contained in:
1 parent
85aa47b489
commit
7ae448f0b1
1 file changed
+4
-6
@@ -399,10 +399,9 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
}
|
||||
#if LINUX
|
||||
else if (!(Char.IsLetterOrDigit(k) || Char.IsPunctuation(k) || Char.IsSymbol(k) || Char.IsWhiteSpace(k)))
|
||||
else if (Char.IsControl(k))
|
||||
{
|
||||
// Whitelist valid input characters: letters, digits, punctuation, symbols whitespace
|
||||
// This is to avoid edge cases like Pause, Print Screen, function keys, and Oem keys, etc.
|
||||
// blacklist control characters
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -1941,10 +1940,9 @@ namespace Microsoft.PowerShell
|
||||
}
|
||||
|
||||
char k = keyInfo.KeyChar;
|
||||
if (!(Char.IsLetterOrDigit(k) || Char.IsPunctuation(k) || Char.IsSymbol(k) || Char.IsWhiteSpace(k)))
|
||||
else if (Char.IsControl(k))
|
||||
{
|
||||
// Whitelist valid input characters: letters, digits, punctuation, symbols whitespace
|
||||
// This is to avoid edge cases like Pause, Print Screen, function keys, and Oem keys, etc.
|
||||
// blacklist control characters
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user