[pve-devel] [PATCH firewall] fix #945: add uninitialized check in lxc ipset compilation

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Apr 20 09:54:39 CEST 2016


---
Note: these are optional properties of an LXC network device,
so they might be undefined.

 src/PVE/Firewall.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 7d021ed..4c1586a 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -3523,10 +3523,10 @@ sub compile_ipsets {
 		    { cidr => $linklocal },
 		    { cidr => 'fe80::/10', nomatch => 1 }
 		];
-		if ($net->{ip} =~ m!^($IPV4RE)(?:/\d+)?$!) {
+		if (defined($net->{ip}) && $net->{ip} =~ m!^($IPV4RE)(?:/\d+)?$!) {
 		    push @$set, { cidr => $1 };
 		}
-		if ($net->{ip6} =~ m!^($IPV6RE)(?:/\d+)?$!) {
+		if (defined($net->{ip6}) && $net->{ip6} =~ m!^($IPV6RE)(?:/\d+)?$!) {
 		    push @$set, { cidr => $1 };
 		}
 	    }
-- 
2.1.4





More information about the pve-devel mailing list