]> git.proxmox.com Git - pve-firewall.git/commitdiff
fix #2005: only allow ascii port digits
authorDominik Csapak <d.csapak@proxmox.com>
Fri, 30 Nov 2018 08:53:49 +0000 (09:53 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 3 Dec 2018 13:10:12 +0000 (14:10 +0100)
perl accepts non-ascii digits for \d like U+09EA
which do not work with iptables

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
src/PVE/Firewall.pm

index ef00d0ce6d31ee82ddad66a2c822c0c094d2753c..035dc7e7a96d1a248997246da8618bb6a649ff1a 100644 (file)
@@ -1049,12 +1049,12 @@ sub parse_port_name_number_or_range {
     my @elements = split(/,/, $str);
     die "extraneous commas in list\n" if $str ne join(',', @elements);
     foreach my $item (@elements) {
-       if ($item =~ m/^(\d+):(\d+)$/) {
+       if ($item =~ m/^([0-9]+):([0-9]+)$/) {
            $count += 2;
            my ($port1, $port2) = ($1, $2);
            die "invalid port '$port1'\n" if $port1 > 65535;
            die "invalid port '$port2'\n" if $port2 > 65535;
-       } elsif ($item =~ m/^(\d+)$/) {
+       } elsif ($item =~ m/^([0-9]+)$/) {
            $count += 1;
            my $port = $1;
            die "invalid port '$port'\n" if $port > 65535;