From 563fc7def9903c804aca526d0f5f471d76f36fd9 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Wed, 11 Mar 2026 14:20:55 +0000 Subject: T8374: convert addresses to the host byte order before comparison when checking that the lower boundary of an IPv4 range is actually lower than the upper bound --- src/ipaddrcheck_functions.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ipaddrcheck_functions.c') diff --git a/src/ipaddrcheck_functions.c b/src/ipaddrcheck_functions.c index 75d8eec..09830a1 100644 --- a/src/ipaddrcheck_functions.c +++ b/src/ipaddrcheck_functions.c @@ -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. */ -- cgit v1.2.3