projects
/
pve-common.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
123c310
)
network: is_ip_in_cidr: avoid warning when versions don't match
author
Fabian Ebner
<f.ebner@proxmox.com>
Mon, 10 May 2021 12:18:14 +0000
(14:18 +0200)
committer
Thomas Lamprecht
<t.lamprecht@proxmox.com>
Thu, 17 Jun 2021 13:17:37 +0000
(15:17 +0200)
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.ebner@proxmox.com>
src/PVE/Network.pm
patch
|
blob
|
blame
|
history
diff --git
a/src/PVE/Network.pm
b/src/PVE/Network.pm
index 366d24236d52f2d3a7be06832942b7baaa23acb2..2d63a45c146d46d26de6e1f139bb1c8afed69d38 100644
(file)
--- 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;
}