From 0951527bfc066aedfe4d90cb97b929e1afc25934 Mon Sep 17 00:00:00 2001 From: Marcos Coelho Date: Thu, 20 Dec 2012 12:56:17 -0200 Subject: [PATCH] put escapeshelltag out of the string --- src/GitList/Git/Repository.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/GitList/Git/Repository.php b/src/GitList/Git/Repository.php index 3d7a568..50d1f37 100644 --- a/src/GitList/Git/Repository.php +++ b/src/GitList/Git/Repository.php @@ -70,7 +70,8 @@ class Repository extends BaseRepository public function searchCommitLog($query) { - $command = "log --grep=".escapeshellarg($query)." --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\""; + $query = escapeshellarg($query); + $command = "log --grep={$query} --pretty=format:\"%H%h%T%P%an%ae%at%cn%ce%ct\""; try { $logs = $this->getPrettyFormat($command); @@ -89,8 +90,10 @@ class Repository extends BaseRepository public function searchTree($query, $branch) { + $query = escapeshellarg($query); + try { - $results = $this->getClient()->run($this, "grep -I --line-number ".escapeshellarg($query)." $branch"); + $results = $this->getClient()->run($this, "grep -I --line-number {$query} $branch"); } catch (\RuntimeException $e) { return false; }