Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #16 from shakaran/bugfix-926-master

Fix bug #926: check empty values of ipaddr and more integrity checks
  • Loading branch information...
commit 370c96b6cdb68d90bb64a499de5c50fce6992207 2 parents 6af1b2e + 3bb11c9
@dterweij authored
View
15 kloxo/httpdocs/htmllib/lib/linuxlib.php
@@ -199,10 +199,17 @@ function getIPs_from_ifcfg()
$list = Ipaddress__Redhat::getCurrentIps();
}
- foreach($list as $k => $v) {
- if ($v['ipaddr'] === '127.0.0.1') { continue; };
-
- $iplist[] = $v['ipaddr'];
+ $iplist = array(); // Initialize return value
+ if(!empty($list)) {
+ foreach($list as $k => $v) {
+ // Check ipaddr index
+ $ip_address = isset($v['ipaddr']) ? $v['ipaddr'] : NULL;
+
+ // Skip localhost IP or empty values
+ if ($ip_address !== '127.0.0.1' && !empty($ip_address)) {
+ $iplist[] = $ip_address;
+ }
+ }
}
return $iplist;
View
2  kloxo/httpdocs/htmllib/lib/pserver/driver/ipaddress__redhatlib.php
@@ -208,7 +208,7 @@ static function getCurrentIps()
}
}
- $result = "";
+ $result = array(); // Initialize as array (expected return result)
foreach($result1 as $res) {
Please sign in to comment.
Something went wrong with that request. Please try again.