[OpenWrt-Devel] [PATCH] firewall3: Immediate continue when no source is specified as it is used later on (seg fault)

Kim De Mey kim.demey at gmail.com
Tue Jan 13 06:27:39 EST 2015


A segmentation fault is currently possible when redir->_src is null and later
the check on redir->_src->masq is done in the line:
if (redir->reflection && redir->_dest && redir->_src->masq)

Proposed fix: continue immediately when redir->_src is null.
---
 redirects.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/redirects.c b/redirects.c
index a30c540..c627607 100644
--- a/redirects.c
+++ b/redirects.c
@@ -306,7 +306,11 @@ fw3_load_redirects(struct fw3_state *state, struct uci_package *p)
 			if (redir->src.any)
 				warn_elem(e, "must not have source '*' for DNAT target");
 			else if (!redir->_src)
+			{
 				warn_elem(e, "has no source specified");
+				fw3_free_redirect(redir);
+				continue;
+			}
 			else
 			{
 				set(redir->_src->flags, FW3_FAMILY_V4, redir->target);
-- 
1.7.9.5
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list