Skip to content

Commit

Permalink
Fix XSS vulnerability, when import is using a file upload without a v…
Browse files Browse the repository at this point in the history
…alid LDIF. Also fixes #250 and closes #251
  • Loading branch information
leenooks committed Jan 10, 2024
1 parent 528081d commit d59cbfe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion htdocs/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function display_pla_parse_error($request) {
printf('<tr><td colspan=2><b>%s</b>:</td></tr>',_('Data'));

foreach ($request->error['data'] as $line)
printf('<tr><td>&nbsp;</td><td>%s</td></tr>',$line);
printf('<tr><td>&nbsp;</td><td>%s</td></tr>',htmlspecialchars($line));

echo '</table>';
echo '</center>';
Expand Down
2 changes: 2 additions & 0 deletions lib/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ public function getDN() {
# If container is not set, we're probably creating the base
elseif ($this->getRDN() && get_request('create_base'))
return $this->getRDN();

return '';
}

public function getDNEncode($url=true) {
Expand Down
4 changes: 3 additions & 1 deletion lib/import_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ public function readEntry() {
return $this->error(sprintf('%s %s',_('LDIF import only suppports version 1'),$version),$lines);

$haveVersion = true;
$lines = $this->nextLines();

if (! $lines)
$lines = $this->nextLines();
}

$server = $this->getServer();
Expand Down

0 comments on commit d59cbfe

Please sign in to comment.