is_ip_in_cidr('fd80:1::10', '127.0.0.1/24') would result in
    Use of uninitialized value in numeric eq (==)
as overlaps() returns undef in such a case.

Note that there are (albeit few) existing callers that don't specify $version.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---

New in v2.

 src/PVE/Network.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/Network.pm b/src/PVE/Network.pm
index 366d242..2d63a45 100644
--- a/src/PVE/Network.pm
+++ b/src/PVE/Network.pm
@@ -594,6 +594,8 @@ sub is_ip_in_cidr {
 
     my $overlap = $cidr_obj->overlaps($ip_obj);
 
+    return if !defined($overlap);
+
     return $overlap == $Net::IP::IP_B_IN_A_OVERLAP || $overlap == 
$Net::IP::IP_IDENTICAL;
 }
 
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to