Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ipaddrcheck_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ int is_ipv4_range(char* range_str, int prefix_length, int verbose)
struct in_addr* left_in_addr = cidr_to_inaddr(left_addr, NULL);
struct in_addr* right_in_addr = cidr_to_inaddr(right_addr, NULL);

if( left_in_addr->s_addr <= right_in_addr->s_addr )
if( ntohl(left_in_addr->s_addr) <= ntohl(right_in_addr->s_addr) )
{
/* If non-zero prefix_length is given,
check if the right address is within the network of the first one. */
Expand Down
1 change: 1 addition & 0 deletions tests/check_ipaddrcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ START_TEST (test_is_ipv4_range)
ck_assert_int_eq(is_ipv4_range("192.0.2.0-192.0.2.10", 0, 1), RESULT_SUCCESS);
ck_assert_int_eq(is_ipv4_range("192.0.2.-", 0, 1), RESULT_FAILURE);
ck_assert_int_eq(is_ipv4_range("192.0.2.99-192.0.2.11", 0, 1), RESULT_FAILURE);
ck_assert_int_eq(is_ipv4_range("192.0.2.0-1.8.2.1", 0, 1), RESULT_FAILURE);
}
END_TEST

Expand Down
Loading