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 20, 2014
1 parent 9364e2e commit b99b6b6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Expand Up @@ -14,6 +14,7 @@ phpMyAdmin - ChangeLog
- bug #4602 Exporting selected rows exports all rows of the query
- bug #4444 No insert statement produced in SQL export for queries with alias
- bug #4596 [security] XSS through exception stack
- bug #4595 [security] Path traversal can lead to leakage of line count

4.2.11.0 (2014-10-31)
- bug ReferenceError: Table_onover is not defined
Expand Down
13 changes: 13 additions & 0 deletions libraries/error_report.lib.php
Expand Up @@ -177,6 +177,19 @@ function PMA_countLines($filename)
return $LINE_COUNT[$filename];
}

// 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 b99b6b6

Please sign in to comment.