package/dnsmasq: update to 2.59 (thanks to Raphael Huck)
[openwrt.git] / package / dropbear / patches / 160-segfault_fwd_localhost.patch
1 http://wl500g.googlecode.com/svn/trunk/dropbear/011-fwd-all-segfault.patch
2 https://dev.openwrt.org/ticket/10339
3
4 --- a/svr-tcpfwd.c
5 +++ b/svr-tcpfwd.c
6 @@ -210,15 +210,13 @@ static int svr_remotetcpreq() {
7         tcpinfo->chantype = &svr_chan_tcpremote;
8         tcpinfo->tcp_type = forwarded;
9  
10 -       if (!opts.listen_fwd_all 
11 -                       || (strcmp(tcpinfo->listenaddr, "localhost") == 0) ) {
12 -        // NULL means "localhost only"
13 -        tcpinfo->listenaddr = NULL;
14 -       }
15 -    else
16 -    {
17 -        tcpinfo->listenaddr = bindaddr;
18 -    }
19 +       if (!opts.listen_fwd_all || (strcmp(bindaddr, "localhost") == 0) ) {
20 +               // NULL means "localhost only"
21 +               tcpinfo->listenaddr = NULL;
22 +       }
23 +       else {
24 +               tcpinfo->listenaddr = bindaddr;
25 +       }
26  
27         ret = listen_tcpfwd(tcpinfo);
28  
29 --- a/tcp-accept.c
30 +++ b/tcp-accept.c
31 @@ -80,6 +80,9 @@ static void tcp_acceptor(struct Listener
32                         addr = tcpinfo->listenaddr;
33                         port = tcpinfo->listenport;
34                 }
35 +               if (!addr) {
36 +                       addr = "localhost";
37 +               }
38  
39                 buf_putstring(ses.writepayload, addr, strlen(addr));
40                 buf_putint(ses.writepayload, port);