[OpenWrt-Devel] [firewall3][PATCH] redirects: fix segmentation fault
Alin Nastac
alin.nastac at gmail.com
Thu May 7 07:14:06 EDT 2020
Fixes 9d7f49df47ad ("redurects: add support to define multiple zones for dnat reflection rules")
Signed-off-by: Alin Nastac <alin.nastac at gmail.com>
---
redirects.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/redirects.c b/redirects.c
index b928287..45a6cb1 100644
--- a/redirects.c
+++ b/redirects.c
@@ -708,9 +708,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)
{
@@ -733,6 +732,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))
@@ -755,12 +757,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
--
2.7.4
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list