From d23a8ea788b866a2542559a4d415f181ab5ea92e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Garci=CC=81a=20de=20La=20Fuente?= Date: Sun, 5 Jan 2014 04:50:54 +0100 Subject: [PATCH] Fixed big XSS problems in open survey module --- htdocs/opensurvey/adminstuds.php | 12 ++++++------ htdocs/opensurvey/adminstuds_preview.php | 15 +++++++-------- htdocs/opensurvey/public/studs.php | 13 ++++++------- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/htdocs/opensurvey/adminstuds.php b/htdocs/opensurvey/adminstuds.php index bb31acf0d99..1f107a7e1af 100644 --- a/htdocs/opensurvey/adminstuds.php +++ b/htdocs/opensurvey/adminstuds.php @@ -193,24 +193,24 @@ $adresseadmin=$object->mail_admin; print $langs->trans("Title") .''; if ($action == 'edit') { - print ''; + print ''; } -else print $object->titre; +else print htmlentities($object->titre); print ''; // Auteur print ''; print $langs->trans("Author") .''; -print $object->nom_admin; +print htmlentities($object->nom_admin); print ''; // Description print ''.$langs->trans("Description") .''; if ($action == 'edit') { - print ''."\n"; + print ''."\n"; } -else print dol_nl2br($object->commentaires); +else print dol_nl2br(htmlentities($object->commentaires)); print ''; // EMail @@ -308,7 +308,7 @@ $comments = $object->getComments(); if ($comments) { foreach ($comments as $comment) { print ' '.img_picto('', 'delete.png').' '; - print $comment->usercomment.': '.dol_nl2br($comment->comment)."
"; + print htmlentities($comment->usercomment).': '.dol_nl2br(htmlentities($comment->comment))."
"; } } else diff --git a/htdocs/opensurvey/adminstuds_preview.php b/htdocs/opensurvey/adminstuds_preview.php index 481912c5fbd..6e8210a21af 100644 --- a/htdocs/opensurvey/adminstuds_preview.php +++ b/htdocs/opensurvey/adminstuds_preview.php @@ -556,16 +556,16 @@ print '
'."\n"; //affichage du titre du sondage $titre=str_replace("\\","",$object->titre); -print ''.$titre.'
'."\n"; +print ''.htmlentities($titre).'
'."\n"; //affichage du nom de l'auteur du sondage -print $langs->trans("InitiatorOfPoll") .' : '.$object->nom_admin.'
'."\n"; +print $langs->trans("InitiatorOfPoll") .' : '.htmlentities($object->nom_admin).'
'."\n"; //affichage des commentaires du sondage if ($object->commentaires) { print '
'.$langs->trans("Description") .' :
'."\n"; - $commentaires=dol_nl2br($object->commentaires); + $commentaires=dol_nl2br(htmlentities($object->commentaires)); print $commentaires; print '
'."\n"; } @@ -695,7 +695,7 @@ if ($object->format=="D"||$object->format=="D+") for ($i = 0; isset($toutsujet[$i]); $i++) { $heures=explode('@', $toutsujet[$i]); if (isset($heures[1])) { - print ''.$heures[1].''."\n"; + print ''.htmlentities($heures[1]).''."\n"; } else { print ''."\n"; } @@ -748,8 +748,7 @@ while ($compteur < $num) print ''."\n"; // Name - $nombase=str_replace("°","'",$obj->nom); - print ''.$nombase.''."\n"; + print ''.htmlentities($obj->nom).''."\n"; // si la ligne n'est pas a changer, on affiche les données if (! $testligneamodifier) @@ -1045,9 +1044,9 @@ if ($nbofcheckbox >= 2) print '

'."\n"; if (isset($meilleurecolonne) && $compteursujet == "1") { - print " " . $langs->trans('TheBestChoice') . " : $meilleursujet " . $langs->trans("with") . " $meilleurecolonne " . $vote_str . ".\n"; + print " " . $langs->trans('TheBestChoice') . " : ".htmlentities($meilleursujet)." " . $langs->trans("with") . " $meilleurecolonne " . $vote_str . ".\n"; } elseif (isset($meilleurecolonne)) { - print " " . $langs->trans('TheBestChoices') . " : $meilleursujet " . $langs->trans("with") . " $meilleurecolonne " . $vote_str . ".\n"; + print " " . $langs->trans('TheBestChoices') . " : ".htmlentities($meilleursujet)." " . $langs->trans("with") . " $meilleurecolonne " . $vote_str . ".\n"; } print '


'."\n"; } diff --git a/htdocs/opensurvey/public/studs.php b/htdocs/opensurvey/public/studs.php index 812555e83e5..f31fd86b124 100644 --- a/htdocs/opensurvey/public/studs.php +++ b/htdocs/opensurvey/public/studs.php @@ -240,16 +240,16 @@ print '
'."\n"; //affichage du titre du sondage $titre=str_replace("\\","",$object->titre); -print ''.$titre.'
'."\n"; +print ''.htmlentities($titre).'
'."\n"; //affichage du nom de l'auteur du sondage -print $langs->trans("InitiatorOfPoll") .' : '.$object->nom_admin.'
'."\n"; +print $langs->trans("InitiatorOfPoll") .' : '.htmlentities($object->nom_admin).'
'."\n"; //affichage des commentaires du sondage if ($object->commentaires) { print '
'.$langs->trans("Description") .' :
'."\n"; - $commentaires=dol_nl2br($object->commentaires); + $commentaires=dol_nl2br(htmlentities($object->commentaires)); print $commentaires; print '
'."\n"; } @@ -339,7 +339,7 @@ if ($object->format=="D"||$object->format=="D+") for ($i=0; isset($toutsujet[$i]); $i++) { $heures=explode('@',$toutsujet[$i]); if (isset($heures[1])) { - print ''.$heures[1].''."\n"; + print ''.htmlentities($heures[1]).''."\n"; } else { print ''."\n"; } @@ -392,8 +392,7 @@ if ($object->allow_spy) { $mod_ok = (! empty($nombase) && in_array($nombase, $listofvoters)); // Name - $nombase=str_replace("°","'",$obj->nom); - print ''.$nombase.''."\n"; + print ''.htmlentities($obj->nom).''."\n"; // si la ligne n'est pas a changer, on affiche les données if (! $testligneamodifier) @@ -691,7 +690,7 @@ if ($comments) foreach ($comments as $obj) { print '
'; if (in_array($obj->usercomment, $listofvoters)) print ' '.img_picto('', 'delete.png').' '; - print $obj->usercomment.' : '.dol_nl2br($obj->comment)."
"; + print htmlentities($obj->usercomment).' : '.dol_nl2br(htmlentities($obj->comment))."
"; } }