Explorar el Código

[Web] escape html of alert messages

FreddleSpl0it hace 1 año
padre
commit
2db8f482db
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      data/web/inc/footer.inc.php

+ 2 - 1
data/web/inc/footer.inc.php

@@ -12,7 +12,8 @@ $alertbox_log_parser = alertbox_log_parser($_SESSION);
 $alerts = [];
 $alerts = [];
 if (is_array($alertbox_log_parser)) {
 if (is_array($alertbox_log_parser)) {
   foreach ($alertbox_log_parser as $log) {
   foreach ($alertbox_log_parser as $log) {
-    $message = strtr($log['msg'], ["\n" => '', "\r" => '', "\t" => '<br>']);
+    $message = htmlspecialchars($log['msg'], ENT_QUOTES);
+    $message = strtr($message, ["\n" => '', "\r" => '', "\t" => '<br>']);
     $alerts[trim($log['type'], '"')][] = trim($message, '"');
     $alerts[trim($log['type'], '"')][] = trim($message, '"');
   }
   }
   $alert = array_filter(array_unique($alerts));
   $alert = array_filter(array_unique($alerts));