@@ -70,8 +70,8 @@ public function convert_document($file, $action_after_conversion = 'make_lp', $s
7070 if (!empty ($ size )) {
7171 list ($ w , $ h ) = explode ('x ' , $ size );
7272 if (!empty ($ w ) && !empty ($ h )) {
73- $ this ->slide_width = $ w ;
74- $ this ->slide_height = $ h ;
73+ $ this ->slide_width = ( int ) $ w ;
74+ $ this ->slide_height = ( int ) $ h ;
7575 }
7676 }
7777
@@ -106,6 +106,7 @@ public function convert_document($file, $action_after_conversion = 'make_lp', $s
106106
107107 $ files = [];
108108 $ return = 0 ;
109+ $ cmd = escapeshellcmd ($ cmd );
109110 $ shell = exec ($ cmd , $ files , $ return );
110111
111112 if ($ return != 0 ) { // If the java application returns an error code.
@@ -211,7 +212,9 @@ public function convertCopyDocument($originalPath, $convertedPath, $convertedTit
211212
212213 $ cmd .= ' -p ' .api_get_setting ('service_ppt2lp ' , 'port ' );
213214 // Call to the function implemented by child.
214- $ cmd .= ' " ' .$ this ->base_work_dir .'/ ' .$ this ->file_path .'" " ' .$ this ->base_work_dir .'/ ' .$ this ->created_dir .'" ' ;
215+ $ cmd .= ' " ' .Security::sanitizeExecParam ($ this ->base_work_dir .'/ ' .$ this ->file_path )
216+ .'" " '
217+ .Security::sanitizeExecParam ($ this ->base_work_dir .'/ ' .$ this ->created_dir ).'" ' ;
215218 // To allow openoffice to manipulate docs.
216219 @chmod ($ this ->base_work_dir , $ permissionFolder );
217220 @chmod ($ this ->base_work_dir .'/ ' .$ this ->file_path , $ permissionFile );
@@ -221,6 +224,7 @@ public function convertCopyDocument($originalPath, $convertedPath, $convertedTit
221224
222225 $ files = [];
223226 $ return = 0 ;
227+ $ cmd = escapeshellcmd ($ cmd );
224228 $ shell = exec ($ cmd , $ files , $ return );
225229 // TODO: Chown is not working, root keep user privileges, should be www-data
226230 @chown ($ this ->base_work_dir .'/ ' .$ this ->created_dir , 'www-data ' );
0 commit comments