Compare commits

..

2 Commits

Author SHA1 Message Date
1826f7e847 fix: guard validation helpers against undef IP 2025-12-28 08:48:29 +01:00
86007a74d8 fix: guard validation helpers against undef host 2025-12-28 08:48:24 +01:00
2 changed files with 2 additions and 0 deletions

View File

@@ -58,6 +58,7 @@ sub sanitize_url {
return undef if $authority =~ /[\s\x00-\x1F\x7F]/; return undef if $authority =~ /[\s\x00-\x1F\x7F]/;
my $hostport = ( split /\@/, $authority )[-1]; my $hostport = ( split /\@/, $authority )[-1];
return undef unless defined $hostport && length $hostport;
my $host_raw; my $host_raw;
if ( $hostport =~ /^\[(.+)\](?::\d+)?$/ ) { if ( $hostport =~ /^\[(.+)\](?::\d+)?$/ ) {
$host_raw = $1; $host_raw = $1;

View File

@@ -71,6 +71,7 @@ sub is_valid_url_length {
sub _is_valid_ipv4 { sub _is_valid_ipv4 {
my ( $self, $ip ) = @_; my ( $self, $ip ) = @_;
return 0 unless defined $ip;
return 0 unless $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; return 0 unless $ip =~ /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/;
my ( $a, $b, $c, $d ) = ( $1, $2, $3, $4 ); my ( $a, $b, $c, $d ) = ( $1, $2, $3, $4 );
return return