From: Tomáš Lejdar Date: Wed, 30 Apr 2003 15:57:01 +0000 (+0000) Subject: Fix libiptc memory hole during iptc_chain_next() (Tomas Lejdar) X-Git-Tag: v1.2.9-rc1~53 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=23a6b4564bc6edecd888530b461093586842acbf;p=thirdparty%2Fiptables.git Fix libiptc memory hole during iptc_chain_next() (Tomas Lejdar) --- diff --git a/libiptc/libiptc.c b/libiptc/libiptc.c index 985b9b0d..55b708b8 100644 --- a/libiptc/libiptc.c +++ b/libiptc/libiptc.c @@ -1,4 +1,4 @@ -/* Library which manipulates firewall rules. Version $Revision: 1.34 $ */ +/* Library which manipulates firewall rules. Version $Revision: 1.35 $ */ /* Architecture of firewall rules is as follows: * @@ -504,8 +504,10 @@ TC_NEXT_CHAIN(TC_HANDLE_T *handle) (*handle)->cache_chain_iteration++; if ((*handle)->cache_chain_iteration - (*handle)->cache_chain_heads - == (*handle)->cache_num_chains) + == (*handle)->cache_num_chains) { + free((*handle)->cache_chain_heads); return NULL; + } return (*handle)->cache_chain_iteration->name; }