But in function is_ipaddress in ping.php?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
knallfrosch
Posts: 13
Joined: Wed Nov 19, 2008 4:08 pm

But in function is_ipaddress in ping.php?

Post by knallfrosch »

Hi,
I stumbled upon an "off by one" error in the is_ipaddress function in ping.php from cacti 0.8.7b.

For IPv4 adresses there is a loop:
foreach($octets as $octet) {
if(($octet < 0) || ($octet >= 255)) {
return false;
}
}

Unfortunately there are valid IPv4 addresses around that contain a 255 in one of the octets, e.g. 172.16.2.255 in the net 172.16.0.0/16. This address won't be pingable and thus marked down.

The fix is trivial: check for $octet > 255 and be done :-).
Obviously this won't keep someone entering a netmask or anything else stupid, but I don't figure that it's possible to check for all stupidity...

I hope this is a valid way to ask for an improvement aka bugfix.

Cheers
Knallfrosch
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

I'm quite sure that this is fixed already in SVN
Neverthelesss: thanks for posting
Reinhard
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests