From 4c65639b2b743073ceab4fbcccf76fb1fe66d0ef Mon Sep 17 00:00:00 2001 From: Steve Allison Date: Thu, 21 Feb 2013 12:39:10 +0000 Subject: [PATCH] Make ip comparison binary safe --- defense.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/defense.php b/defense.php index e21b365..dc40211 100644 --- a/defense.php +++ b/defense.php @@ -41,7 +41,8 @@ class defense extends rcube_plugin { */ private function isIPinArray($ip, $array) { foreach ($array as $value) { - if ((strpos($value, '/') === false) && ($ip == $value)) { return true; } + // If no slash '/' then its not a CIDR address and we can just string match + if ((strpos($value, '/') === false) && (strcmp($ip, $value) == 0)) { return true; } if ($this->isIPv4inCIDR($ip, $value)) { return true; } } return false;