]> git.p6c8.net - jirafeau_mojo42.git/commitdiff
better checks in ip listing
authorJerome Jutteau <mojo@couak.net>
Tue, 29 Sep 2015 14:43:32 +0000 (16:43 +0200)
committerJerome Jutteau <mojo@couak.net>
Tue, 29 Sep 2015 14:43:32 +0000 (16:43 +0200)
Signed-off-by: Jerome Jutteau <mojo@couak.net>
lib/functions.php

index 83fdaf1a6ec8d84d51b0008eec4f3dedd66e6b58..aaa0daf4ff409b23cb306805f89b5f3272a47395 100644 (file)
@@ -1121,6 +1121,8 @@ get_ip_list_http_forwarded()
     if (!empty ($_SERVER['HTTP_X_FORWARDED_FOR']))
     {
         $l = explode (',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+        if ($l === FALSE)
+            return array();
         foreach ($l as $ip)
             array_push ($ip_list, preg_replace ('/\s+/', '', $ip));
     }
@@ -1130,7 +1132,10 @@ get_ip_list_http_forwarded()
         foreach ($l as $ip)
         {
             // Separate IP from port
-            $ip = explode (':', $ip)[0];
+            $ipa = explode (':', $ip);
+            if ($ipa === FALSE)
+                continue;
+            $ip = $ipa[0];
             array_push ($ip_list, preg_replace ('/\s+/', '', $ip));
         }
     }

patrick-canterino.de