]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Allocate enough memory for addr-list in host_to_addr()
authorPatrick McHardy <kaber@trash.net>
Tue, 3 Aug 2004 22:38:39 +0000 (22:38 +0000)
committerPatrick McHardy <kaber@trash.net>
Tue, 3 Aug 2004 22:38:39 +0000 (22:38 +0000)
iptables.c

index 6ab4c49716db396e2c226ed9dfff6ae2bf01db23..c69eb43de92702544db55c5e901ef84fbb8682a4 100644 (file)
@@ -551,7 +551,7 @@ host_to_addr(const char *name, unsigned int *naddr)
 
                while (host->h_addr_list[*naddr] != (char *) NULL)
                        (*naddr)++;
-               addr = fw_calloc(*naddr, sizeof(struct in_addr));
+               addr = fw_calloc(*naddr, sizeof(struct in_addr) * *naddr);
                for (i = 0; i < *naddr; i++)
                        inaddrcpy(&(addr[i]),
                                  (struct in_addr *) host->h_addr_list[i]);