[pve-devel] [PULL stable-3 firewall 1/6] fix 901: encode unicode characters in sha digest
Wolfgang Bumiller
w.bumiller at proxmox.com
Mon Mar 7 14:44:54 CET 2016
From: Dominik Csapak <d.csapak at proxmox.com>
if we do not do this, Digest::SHA->add croaks when it detects
wide symbols
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/Firewall.pm | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 8bd45c5..1e412ce 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -1083,7 +1083,10 @@ sub copy_list_with_digest {
next if !defined($v);
$data->{$k} = $v;
# Note: digest ignores refs ($rule->{errors})
- $sha->add($k, ':', $v, "\n") if !ref($v); ;
+ # since Digest::SHA expects a series of bytes,
+ # we have to encode the value here to prevent errors when
+ # using utf8 characters (eg. in comments)
+ $sha->add($k, ':', encode_utf8($v), "\n") if !ref($v); ;
}
push @$res, $data;
}
--
2.1.4
More information about the pve-devel
mailing list