align functions add_cidr() and add_range()

* call freeaddrinfo() before checking the prefix length in
  add_cidr()
* add a comment to the generator limit check in add_range()
pull/334/head
Erik Auerswald 6 months ago
parent ab20b150b8
commit d0ed64bcc7

@ -1282,6 +1282,7 @@ void add_cidr(char *addr)
exit(1);
}
net_addr = ntohl(((struct sockaddr_in *)addr_res->ai_addr)->sin_addr.s_addr);
freeaddrinfo(addr_res);
/* check mask */
if (mask < 1 || mask > 32) {
@ -1310,8 +1311,6 @@ void add_cidr(char *addr)
inet_ntop(AF_INET, &in_addr_tmp, buffer, sizeof(buffer));
add_name(buffer);
}
freeaddrinfo(addr_res);
}
void add_range(char *start, char *end)
@ -1355,6 +1354,7 @@ void add_range(char *start, char *end)
end_long = ntohl(((struct sockaddr_in *)addr_res->ai_addr)->sin_addr.s_addr);
freeaddrinfo(addr_res);
/* check if generator limit is exceeded */
if (end_long > start_long + MAX_GENERATE) {
fprintf(stderr, "%s: -g parameter generates too many addresses\n", prog);
exit(1);

Loading…
Cancel
Save