Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/IPQualityScore/DB/DBReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ public function Fetch($ip){
throw new FileReaderException("Attemtped to look up IPv6 using IPv4 database file. Aborting.");
}

list(, $subnet, ) = explode('/', "0.0.0.0/8");
$incomingIP = ip2long($ip);
if (ip2long($subnet) <= $incomingIP && $incomingIP <= ip2long('255.255.255.255')) {
// ip is in acceptable range
} else {
throw new Exception("Attempted to look up ip in 0.0.0.0/8 range. Aborting.");
}

$position = 0;
$previous = array();
$literal = $this->IP2Literal($ip);
Expand Down