Skip to content

Commit

Permalink
bug #4595 [security] Path traversal can lead to leakage of line count
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Nov 17, 2014
1 parent c641ad4 commit da44dd4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -3,6 +3,7 @@ phpMyAdmin - ChangeLog

4.1.14.7 (not yet released)
- bug #4596 [security] XSS through exception stack
- bug #4595 [security] Path traversal can lead to leakage of line count

4.1.14.6 (2014-10-21)
- bug #4562 [security] XSS in debug SQL output
Expand Down
14 changes: 14 additions & 0 deletions libraries/error_report.lib.php
Expand Up @@ -181,6 +181,20 @@ function PMA_countLines($filename)
{
global $LINE_COUNT;
if (!defined('LINE_COUNTS')) {

// ensure that the file is inside the phpMyAdmin folder
$depath = 1;
foreach (explode('/', $filename) as $part) {
if ($part == '..') {
$depath--;
} elseif ($part != '.') {
$depath++;
}
if ($depath < 0) {
return 0;
}
}

$linecount = 0;
$handle = fopen('./js/' . $filename, 'r');
while (!feof($handle)) {
Expand Down

0 comments on commit da44dd4

Please sign in to comment.