From 76fa8a7334d93184ca97a97373e08bf56ce9a76e Mon Sep 17 00:00:00 2001 From: Kharec Date: Mon, 29 Dec 2025 15:45:52 +0100 Subject: [PATCH] fix: correct IPv6 private range checks --- lib/Urupam/Validation.pm | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/lib/Urupam/Validation.pm b/lib/Urupam/Validation.pm index 34ff474..a892d55 100644 --- a/lib/Urupam/Validation.pm +++ b/lib/Urupam/Validation.pm @@ -117,19 +117,8 @@ sub _is_private_ipv6 { my $first = hex($first_part); - if ( $first >= 0xfc && $first <= 0xfd ) { - return 1; - } - - if ( $first == 0xfe && @parts > 1 ) { - my $second_part = $parts[1] || ''; - if ( length($second_part) > 0 ) { - my $second = hex($second_part); - if ( $second >= 0x80 && $second <= 0xbf ) { - return 1; - } - } - } + return 1 if ( $first & 0xfe00 ) == 0xfc00; + return 1 if ( $first & 0xffc0 ) == 0xfe80; return 0; }