From: Wes Campaigne Date: Tue, 22 Feb 2011 00:10:11 +0000 (-0500) Subject: xtables: fix excessive memory allocation in host_to_ipaddr X-Git-Tag: v1.4.11~57 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11e250ba02349cb1e34058673db3d0b54eb56c44;p=thirdparty%2Fiptables.git 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 --- 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));