xtables: fix excessive memory allocation in host_to_ipaddr
host_to_ipaddr was unnecessarily asking for an array of length n^2 to
store just n addresses.
Signed-off-by: Wes Campaigne <westacular@gmail.com>
diff --git a/xtables.c b/xtables.c
index 83c5b41..b45bf92 100644
--- a/xtables.c
+++ b/xtables.c
@@ -1143,7 +1143,7 @@
while (host->h_addr_list[*naddr] != NULL)
++*naddr;
- addr = xtables_calloc(*naddr, sizeof(struct in_addr) * *naddr);
+ addr = xtables_calloc(*naddr, sizeof(struct in_addr));
for (i = 0; i < *naddr; i++)
memcpy(&addr[i], host->h_addr_list[i],
sizeof(struct in_addr));