Skip to content

Commit

Permalink
whois: forbid query containing only whitespace (#538)
Browse files Browse the repository at this point in the history
* A correctly formed whois query will contain non-whitespace characters so catch invalid input before connecting to whois server
* Example bad input: perl whois ' '
  • Loading branch information
mknos committed Apr 10, 2024
1 parent 30cc586 commit 04a2376
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/whois
Expand Up @@ -50,6 +50,10 @@ exit EX_SUCCESS;

sub whois {
my $domain = shift;
if (length($domain) == 0 || $domain !~ m/\S/) {
warn "empty domain name\n";
exit EX_FAILURE;
}
my $sock = IO::Socket::INET->new(
PeerAddr => $host,
PeerPort => 43,
Expand Down

0 comments on commit 04a2376

Please sign in to comment.