From 04b83c9a114af7decf41e5f4d543d13705f9009c Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Tue, 30 Mar 2021 17:15:40 +0200 Subject: [PATCH] M #-: Escape shell commands in VN drivers (#1025) --- src/mad/ruby/scripts_common.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/mad/ruby/scripts_common.rb b/src/mad/ruby/scripts_common.rb index 4562b8e9c6..eb52c772bd 100644 --- a/src/mad/ruby/scripts_common.rb +++ b/src/mad/ruby/scripts_common.rb @@ -14,6 +14,8 @@ # limitations under the License. # #--------------------------------------------------------------------------- # +require 'shellwords' + module OpenNebula # Generic log function @@ -76,6 +78,7 @@ module OpenNebula # If a second parameter is present it is used as the error message when # the command fails def self.exec_and_log(command, message=nil, allowed_return_code=0) + command = command.shellsplit.shelljoin # escape output=`#{command} 2>&1 1>/dev/null` code=$?.exitstatus