Skip to content

Commit

Permalink
Prevent shell injection in the search string like reported by cmalone…
Browse files Browse the repository at this point in the history
…y3030@gmail.com.
  • Loading branch information
AM-SoFT Support authored and ams-tschoening committed May 11, 2021
1 parent 94aa3eb commit 6832ed1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/svnlook.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ function listFileContents($path, $rev = 0, $peg = '') {
}

// }}}

// {{{ listReadmeContents
//
// Parse the README.md file
Expand Down Expand Up @@ -895,7 +895,7 @@ function listReadmeContents($path, $rev = 0, $peg = '') {
}

echo('<div id="wrap">');
while (!feof($result))
while (!feof($result))
{
$line = fgets($result, 1024);
echo $mdParser->text($line);
Expand Down Expand Up @@ -1134,7 +1134,9 @@ function getListSearch($path,$searchstring='', $rev = 0, $peg = '') {
$rev = $headlog->entries[0]->rev;
}

$cmd = $this->svnCommandString('list -R --search '. '"'.$searchstring.'"'.' --xml', $path, $rev, $peg);
$searchstring = escapeshellarg($searchstring);
$cmd = 'list -R --search ' . $searchstring . ' --xml';
$cmd = $this->svnCommandString($cmd, $path, $rev, $peg);
$this->_xmlParseCmdOutput($cmd, 'listStartElement', 'listEndElement', 'listCharacterData');

return $curList;
Expand Down

0 comments on commit 6832ed1

Please sign in to comment.