Escape path

This commit is contained in:
Dennis Eichhorn 2016-08-14 12:10:32 +02:00
parent f599693f11
commit d26e71971f
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ class Git
public static function test() : bool
{
$pipes = [];
$resource = proc_open(Git::getBin(), [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
$resource = proc_open(escapeshellarg(Git::getBin()), [1 => ['pipe', 'w'], 2 => ['pipe', 'w']], $pipes);
$stdout = stream_get_contents($pipes[1]);
$stderr = stream_get_contents($pipes[2]);

View File

@ -177,7 +177,7 @@ class Repository
*/
private function run(string $cmd) : array
{
$cmd = Git::getBin() . ' ' . $cmd;
$cmd = escapeshellarg(Git::getBin()) . ' ' . $cmd;
$pipes = [];
$desc = [
1 => ['pipe', 'w'],
@ -203,7 +203,7 @@ class Repository
$status = trim(proc_close($resource));
if ($status) {
if ($status == -1) {
throw new \Exception($stderr);
}