From f53a77301f3efce30c6f404816ab9f18bc55983d Mon Sep 17 00:00:00 2001 From: Promofaux Date: Fri, 16 Sep 2016 23:42:13 +0100 Subject: [PATCH] in findAds: ensure count($exploded) == 8 --- data.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/data.php b/data.php index f48940d1..b28072fe 100644 --- a/data.php +++ b/data.php @@ -267,13 +267,18 @@ function findAds($var) { $exploded = explode(" ", $var); - $tmp = $exploded[count($exploded)-4]; - $tmp2 = $exploded[count($exploded)-5]; - $tmp3 = $exploded[count($exploded) -3]; - $hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F"); + if(count($exploded) == 8) { + $tmp = $exploded[count($exploded) - 4]; + $tmp2 = $exploded[count($exploded) - 5]; + $tmp3 = $exploded[count($exploded) - 3]; + $hostname = trim(file_get_contents("/etc/hostname"), "\x00..\x1F"); + //filter out bad names and host file reloads: + return (substr($tmp, strlen($tmp) - 12, 12) == "gravity.list" && $tmp2 != "read" && $tmp3 != "pi.hole" && $tmp3 != $hostname); + } + else{ + return false; + } - //filter out bad names and host file reloads: - return (substr($tmp, strlen($tmp) - 12, 12) == "gravity.list" && $tmp2 != "read" && $tmp3 != "pi.hole" && $tmp3 != $hostname) ; } function findForwards($var) {