[ZBX-32] bug in ip_in_list Created: 2007 Sep 01  Updated: 2017 May 30  Resolved: 2007 Sep 03

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Server (S)
Affects Version/s: 1.4.2
Fix Version/s: 1.4.3

Type: Incident report Priority: Major
Reporter: Alexei Vladishev Assignee: Alexander Vladishev
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File zabbix-1.4.1-ip_in_list.patch    

 Description   

(previously posted as
http://www.zabbix.com/forum/showthread.php?t=6993)

The way zabbix 1.4.2 implements ip_in_list is buggy. As you strcmp the ip and the range, the comparison will fail in the following example:

range: 10.0.0.1-10.0.0.255
ip: 10.0.0.30

First, you strcmp(10.0.0.30,10.0.0.1) and get, as expected, >0. Then, however, you strcmp(10.0.0.30,10.0.0.255) which, as 3 > 2, will also return >0.

I have created a patch to fix this by actually comparing the int values. While I'm sure there's a more c-ish way to do this, it seems to work.

Regards
Stefan

http://www.zabbix.com/forum/showthread.php?t=7515


Generated at Mon Apr 21 23:57:01 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.