[PATCH] Avoiding segfault in Snow Leopard when not using -i option

Jørgen Wahlberg jorgen at wahlberg.no
Sat Feb 27 08:56:09 EST 2010


Hi,

I am testing openconnect on Mac OS X (Snow Leopard, 10.6.2) and experienced a problem when connecting using the example in the documentation (openconnect --script /etc/vpnc/vpnc-script https://vpn.mycompany.com/) - 
openconnect crashed because of a segmentation violation. I compiled openconnect from HEAD in the Git repository. Using the -i option to specify the tun interface was an acceptable workaround for me, but nevertheless, I submit a patch.

 - jørgen


Signed-off-by: Jørgen Wahlberg <jorgen at jaws.no>

diff --git a/tun.c b/tun.c
index cdae108..2c33386 100644
--- a/tun.c
+++ b/tun.c
@@ -239,7 +239,8 @@ static void set_script_env(struct openconnect_info *vpninfo)
                              sizeof(host), NULL, 0, NI_NUMERICHOST);
        if (!ret)
                setenv("VPNGATEWAY", host, 1);
-       setenv("TUNDEV", vpninfo->ifname, 1);
+       if (vpninfo->ifname)
+           setenv("TUNDEV", vpninfo->ifname, 1);
        setenv("reason", "connect", 1);
        unsetenv("CISCO_BANNER");
        unsetenv("CISCO_SPLIT_INC");






More information about the openconnect-devel mailing list