From cc27e637733a763c1117002785c02284cc670961 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Tue, 13 Feb 2018 10:59:00 +0100 Subject: [PATCH] Exception control added to safe_input and safe_output --- pandora_server/lib/PandoraFMS/Tools.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora_server/lib/PandoraFMS/Tools.pm b/pandora_server/lib/PandoraFMS/Tools.pm index d2c82dcd44..fe528042b8 100755 --- a/pandora_server/lib/PandoraFMS/Tools.pm +++ b/pandora_server/lib/PandoraFMS/Tools.pm @@ -349,7 +349,9 @@ sub pandora_trash_ascii { ######################################################################## sub safe_input($) { my $value = shift; - + + return "" unless defined($value); + $value =~ s/([\x00-\xFF])/$CHR2ENT{$1}||$1/ge; return $value; @@ -360,7 +362,9 @@ sub safe_input($) { ######################################################################## sub safe_output($) { my $value = shift; - + + return "" unless defined($value); + _decode_entities ($value, \%ENT2CHR); return $value;