diff options
author | Wes Campaigne <westacular@gmail.com> | 2011-02-21 19:10:11 -0500 |
---|---|---|
committer | Jan Engelhardt <jengelh@medozas.de> | 2011-02-26 23:48:40 +0100 |
commit | 11e250ba02349cb1e34058673db3d0b54eb56c44 (patch) | |
tree | 713f548b4a3c343874872e7b2c6fdab1ccac3f06 /xtables.c | |
parent | 64230aa45c5ad8505d81812d19bd2ee9a37e3467 (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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)); |