mirror of
https://github.com/Karaka-Management/phpOMS.git
synced 2026-02-08 13:28:39 +00:00
Escape path
This commit is contained in:
parent
f599693f11
commit
d26e71971f
|
|
@ -49,7 +49,7 @@ class Git
|
||||||
public static function test() : bool
|
public static function test() : bool
|
||||||
{
|
{
|
||||||
$pipes = [];
|
$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]);
|
$stdout = stream_get_contents($pipes[1]);
|
||||||
$stderr = stream_get_contents($pipes[2]);
|
$stderr = stream_get_contents($pipes[2]);
|
||||||
|
|
|
||||||
|
|
@ -177,7 +177,7 @@ class Repository
|
||||||
*/
|
*/
|
||||||
private function run(string $cmd) : array
|
private function run(string $cmd) : array
|
||||||
{
|
{
|
||||||
$cmd = Git::getBin() . ' ' . $cmd;
|
$cmd = escapeshellarg(Git::getBin()) . ' ' . $cmd;
|
||||||
$pipes = [];
|
$pipes = [];
|
||||||
$desc = [
|
$desc = [
|
||||||
1 => ['pipe', 'w'],
|
1 => ['pipe', 'w'],
|
||||||
|
|
@ -203,7 +203,7 @@ class Repository
|
||||||
|
|
||||||
$status = trim(proc_close($resource));
|
$status = trim(proc_close($resource));
|
||||||
|
|
||||||
if ($status) {
|
if ($status == -1) {
|
||||||
throw new \Exception($stderr);
|
throw new \Exception($stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user