2014-05-08 Junichi Satoh <junichi@rworks.jp>

* lib/PandoraFMS/ReconServer.pm: Fixed crash when macros help of
	recon script contains \r, \n or multibyte characters.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9886 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
jsatoh 2014-05-08 05:12:08 +00:00
parent 39d2418cff
commit ee1b1f022d
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-05-08 Junichi Satoh <junichi@rworks.jp>
* lib/PandoraFMS/ReconServer.pm: Fixed crash when macros help of
recon script contains \r, \n or multibyte characters.
2014-05-07 Ramon Novoa <rnovoa@artica.es>
* lib/PandoraFMS/Tools.pm: Added code to initialize the enterprise module.

View File

@ -27,6 +27,7 @@ use Thread::Semaphore;
use IO::Socket::INET;
use POSIX qw(strftime ceil);
use JSON qw(decode_json encode_json);
use Encode qw(encode_utf8);
# Default lib dir for RPM and DEB packages
use lib '/usr/lib/perl5';
@ -484,7 +485,11 @@ sub exec_recon_script ($$$) {
my $command = safe_output($script->{'script'});
my $macros = safe_output($task->{'macros'});
my $decoded_macros = decode_json ($macros);
# \r and \n should be escaped for decode_json().
$macros =~ s/\n/\\n/g;
$macros =~ s/\r/\\r/g;
my $decoded_macros = decode_json (encode_utf8($macros));
my $macros_parameters = '';