summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-03-28 13:44:30 +0500
committerilotterytea <iltsu@alright.party>2025-03-28 13:44:30 +0500
commit70d3e4b5e9dde9b7601ca08c9da1f3e1fb173570 (patch)
tree2918004b36a8016b9bec4606cea2d039e1cdf819
parentd01f559c50bb2f6e1a0ab4b0ddbc7adcd0c01a74 (diff)
fix: xss and regex vulnerabilityHEADmaster
-rw-r--r--public/index.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/public/index.php b/public/index.php
index af30a76..315a79f 100644
--- a/public/index.php
+++ b/public/index.php
@@ -10,10 +10,13 @@ if (-12 <= $utc && $utc <= 12) {
$utc = 0;
}
-$month = $_GET["month"] ?? date("n", $time);
-$day = $_GET["day"] ?? date("d", $time);
+$month = intval($_GET["month"] ?? date("n", $time));
+$day = intval($_GET["day"] ?? date("d", $time));
+
$search = $_GET["search"] ?? "";
-$search_regex = "/(?i)$search/";
+$search_regex = "/(?i)" . preg_quote($search, "/") . "/";
+
+$search = htmlspecialchars($search);
$holidays = [];