summaryrefslogtreecommitdiffstats
path: root/xtables.c
diff options
context:
space:
mode:
authorWes Campaigne <westacular@gmail.com>2011-02-21 19:10:11 -0500
committerJan Engelhardt <jengelh@medozas.de>2011-02-26 23:48:40 +0100
commit11e250ba02349cb1e34058673db3d0b54eb56c44 (patch)
tree713f548b4a3c343874872e7b2c6fdab1ccac3f06 /xtables.c
parent64230aa45c5ad8505d81812d19bd2ee9a37e3467 (diff)
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>
Diffstat (limited to 'xtables.c')
-rw-r--r--xtables.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/xtables.c b/xtables.c
index 83c5b41f..b45bf928 100644
--- a/xtables.c
+++ b/xtables.c
@@ -1143,7 +1143,7 @@ static struct in_addr *host_to_ipaddr(const char *name, unsigned int *naddr)
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));