Browse code

Start of reviewing filtering practices. Also fixed hash filtering in dltorrent as referenced here: http://www.osvdb.org/79805

Clarissa Walker authored on 2015/09/14 04:19:18
Showing 2 changed files
... ...
@@ -13,7 +13,7 @@ if (!$_SESSION['admin_logged_in'] && !$_SESSION['upload_logged_in'])
13 13
 
14 14
 
15 15
 //if hash isn't of length 40, don't even bother connecting to database
16
-if (strlen($_GET['hash']) != 40)
16
+if (strlen(htmlentities($_GET['hash'], ENT_QUOTES, UTF-8)) != 40)
17 17
 {
18 18
 	header("index.php"); 	
19 19
   	exit();
... ...
@@ -133,14 +133,14 @@ if (file_exists("rss/rss.xml"))
133 133
 	<?php
134 134
 	//Cleanup page number to prevent XSS
135 135
 	if (isset($_GET["page_number"])) {
136
-		$_GET["page_number"] = htmlspecialchars($_GET["page_number"]);
136
+		$_GET["page_number"] = htmlentities($_GET["page_number"], ENT_QUOTES);
137 137
 	} else {
138 138
 		$_GET["page_number"] = "";
139 139
 	}
140 140
 	$scriptname = htmlspecialchars($scriptname);
141 141
 	
142 142
 	if (!isset($_GET["activeonly"]))
143
-		$scriptname = $scriptname . "activeonly=	yes&amp;";
143
+		$scriptname = $scriptname . "activeonly=yes&amp;";
144 144
 	if (isset($_GET["seededonly"]) && !isset($_GET["activeonly"]))
145 145
 	{
146 146
 		$scriptname = $scriptname . "seededonly=yes&";