[pve-devel] [PATCH firewall] fix use of uninitialized value

Mira Limbeck m.limbeck at proxmox.com
Mon Aug 26 14:55:25 CEST 2019


$param->{rename} was not checked for definedness even though it is
optional. This lead to a 'use of uninitialized value' when just updating
the cidr.

Signed-off-by: Mira Limbeck <m.limbeck at proxmox.com>
---
 src/PVE/API2/Firewall/Aliases.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Firewall/Aliases.pm b/src/PVE/API2/Firewall/Aliases.pm
index 6f421fb..b81dc9d 100644
--- a/src/PVE/API2/Firewall/Aliases.pm
+++ b/src/PVE/API2/Firewall/Aliases.pm
@@ -230,7 +230,8 @@ sub register_update_alias {
 
 	    $aliases->{$name} = $data;
 
-	    my $rename = lc($param->{rename});
+	    my $rename = $param->{rename};
+	    $rename = lc($rename) if $rename;
 
 	    if ($rename && ($name ne $rename)) {
 		raise_param_exc({ name => "alias '$param->{rename}' already exists" }) 
-- 
2.20.1




More information about the pve-devel mailing list