[pve-devel] [PATCH firewall] Fix unitialized value $mark in bitwise operation

Alwin Antreich a.antreich at proxmox.com
Wed Feb 13 12:27:58 CET 2019


Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 src/PVE/FirewallSimulator.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/PVE/FirewallSimulator.pm b/src/PVE/FirewallSimulator.pm
index b01e45b..188c38f 100644
--- a/src/PVE/FirewallSimulator.pm
+++ b/src/PVE/FirewallSimulator.pm
@@ -21,7 +21,7 @@ eval {
     $have_lxc = 1;
 };
 
-my $mark;
+my $mark = 0;
 my $trace;
 my $debug = 0;
 
@@ -227,7 +227,7 @@ sub rule_match {
 
 	if ($rule =~ s@^-m mark --mark ($NUMBER_RE)(?:/($NUMBER_RE))?\s*@@) {
 	    my ($value, $mask) = PVE::Firewall::get_mark_values($1, $2);
-	    return undef if !defined($mark) || ($mark & $mask) != $value;
+	    return undef if ($mark & $mask) != $value;
 	    next;
 	}
 
-- 
2.11.0





More information about the pve-devel mailing list