Skip to content

Commit

Permalink
Fix XSS for report name
Browse files Browse the repository at this point in the history
  • Loading branch information
craigk5n committed Jan 31, 2024
1 parent a79ddf4 commit 224a5ae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion edit_report.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function print_options ( $textarea, $option ) {
<div class="form-inline">
<label class="col-sm-2 col-form-label" for="rpt_name">' . translate ('Report Name') . '</label>
<input class="form-control" type="text" name="report_name" id="rpt_name" size="40" ' .
'maxlength="50" value="' . $report_name . '"></div>';
'maxlength="50" value="' . htmlentities($report_name) . '"></div>';

if ( $show_participants ) {
echo '<div class="form-inline">
Expand Down
7 changes: 4 additions & 3 deletions report.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ function event_to_text ( $event, $date ) {
} else
$id = $event->getID();

$name_str = $description_str = '';
if ( $tempAcc == 'R' ) {
if ( ( $login != $user && strlen ( $user ) ) ||
( $login != $tempLog && strlen ( $tempLog ) ) ) {
Expand Down Expand Up @@ -237,9 +238,9 @@ function event_to_text ( $event, $date ) {
$addStr = translate ( 'Add new report' );
$unnamesStr = translate ( 'Unnamed Report' );
while ( $row = dbi_fetch_row ( $res ) ) {
$rep_name = trim ( $row[1] );
$rep_name = htmlentities(trim($row[1]));
if ( empty ( $rep_name ) )
$rep_name = $unnamesStr;
$rep_name = htmlentities($unnamesStr);

$list .= '
<li class="nav"><a href="edit_report.php?report_id=' . $row[0] . '" class="nav">'
Expand Down Expand Up @@ -463,7 +464,7 @@ function event_to_text ( $event, $date ) {
$nextStr = translate ( 'Next' );
$prevStr = translate ( 'Previous' );
$reportNameStr = ( $include_header ? '
<h2>' . $report_name . '</h2>' : '' );
<h2>' . htmlentities($report_name) . '</h2>' : '' );

if ( ! empty ( $report_allow_nav ) && $report_allow_nav == 'Y' ) {
$temp = '" href="report.php?report_id=' . $report_id . $u_url . '&amp;offset=';
Expand Down

0 comments on commit 224a5ae

Please sign in to comment.