From: Alin Nastac Date: Thu, 7 May 2020 11:14:06 +0000 (+0200) Subject: redirects: fix segmentation fault X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=050816af322f0a8ed8dd04d620f42cb3d0a1ac06;p=oweals%2Ffirewall3.git redirects: fix segmentation fault Fixes 9d7f49df47ad ("redurects: add support to define multiple zones for dnat reflection rules") Signed-off-by: Alin Nastac --- diff --git a/redirects.c b/redirects.c index 775fade..9a827b6 100644 --- a/redirects.c +++ b/redirects.c @@ -716,9 +716,8 @@ expand_redirect(struct fw3_ipt_handle *handle, struct fw3_state *state, return; ext_addrs = fw3_resolve_zone_addresses(redir->_src, &redir->ip_dest); - if (!ext_addrs) - goto out; + return; list_for_each_entry(ext_addr, ext_addrs, list) { @@ -741,6 +740,9 @@ expand_redirect(struct fw3_ipt_handle *handle, struct fw3_state *state, continue; int_addrs = fw3_resolve_zone_addresses(zone, NULL); + if (!int_addrs) + continue; + list_for_each_entry(int_addr, int_addrs, list) { if (!fw3_is_family(int_addr, handle->family)) @@ -763,12 +765,12 @@ expand_redirect(struct fw3_ipt_handle *handle, struct fw3_state *state, &ref_addr, int_addr, ext_addr, reflection_zone); } } + + fw3_free_list(int_addrs); } } -out: fw3_free_list(ext_addrs); - fw3_free_list(int_addrs); } void