From e827b6719ab3f632b96efb32cc05197b13b4c247 Mon Sep 17 00:00:00 2001 From: David Schweikert Date: Tue, 24 Jan 2017 09:08:39 +0100 Subject: [PATCH] another attempt at fixing coverity warning --- src/fping.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/fping.c b/src/fping.c index 051469e..cf39086 100644 --- a/src/fping.c +++ b/src/fping.c @@ -967,19 +967,18 @@ void add_range(char *start, char *end) end_long = ntohl(((struct sockaddr_in *) addr_res->ai_addr)->sin_addr.s_addr); freeaddrinfo(addr_res); - if(end_long - start_long > MAX_LOOP) { + if(end_long > start_long + MAX_LOOP) { fprintf(stderr, "Error: -g parameter generates too many addresses\n"); exit(1); } /* generate */ - while(start_long <= end_long) { + for(; start_long <= end_long; start_long++) { struct in_addr in_addr_tmp; char buffer[20]; in_addr_tmp.s_addr = htonl(start_long); inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer)); add_name(buffer); - start_long++; } }