Use wfShellExec in MimeMagic
authorumherirrender <umherirrender_de.wp@web.de>
Sun, 21 Apr 2013 14:59:18 +0000 (16:59 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 25 Apr 2013 19:25:18 +0000 (19:25 +0000)
This avoids shell execution with backticks

Change-Id: I37ca19f4b19a3a7f2834a234051e4044653fcfb1

includes/MimeMagic.php

index 24d803b..1627b3d 100644 (file)
@@ -876,9 +876,8 @@ class MimeMagic {
 
                $m = null;
                if ( $wgMimeDetectorCommand ) {
-                       // @todo FIXME: Use wfShellExec
-                       $fn = wfEscapeShellArg( $file );
-                       $m = `$wgMimeDetectorCommand $fn`;
+                       $args = wfEscapeShellArg( $file );
+                       $m = wfShellExec( "$wgMimeDetectorCommand $args" );
                } elseif ( function_exists( "finfo_open" ) && function_exists( "finfo_file" ) ) {
 
                        # This required the fileinfo extension by PECL,