]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Fix Windows tun setup crash
authorDavid Woodhouse <dwmw2@infradead.org>
Sat, 26 Feb 2022 17:34:26 +0000 (17:34 +0000)
committerDavid Woodhouse <dwmw2@infradead.org>
Sat, 26 Feb 2022 17:34:26 +0000 (17:34 +0000)
The intention was to use vpninfo->hostname, by passing it as a parameter
to the create_ifname_w() function. But that function still just uses
vpninfo->ifname unconditionally, ignoring the argument. And causing the
crash in #370.

Fix up some bogus formatting while we're at it. We don't do open braces
on the same line as the function declaration.

Fixes: 48bd28aadd ("Use hostname as Wintun ifname (if ifname not specified)")
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
tun-win32.c

index 208c44a03bfaaab50e72014f51d552fe7679696c..f0ee48852e623172a7e21857250a77cb221ed757 100644 (file)
@@ -477,9 +477,12 @@ static intptr_t open_tun(struct openconnect_info *vpninfo, int adapter_type, cha
        return ret;
 }
 
-static intptr_t create_ifname_w(struct openconnect_info *vpninfo, const char *ifname) {
+static intptr_t create_ifname_w(struct openconnect_info *vpninfo,
+                               const char *ifname)
+{
        struct oc_text_buf *ifname_buf = buf_alloc();
-       buf_append_utf16le(ifname_buf, vpninfo->ifname);
+
+       buf_append_utf16le(ifname_buf, ifname);
 
        if (buf_error(ifname_buf)) {
                vpn_progress(vpninfo, PRG_ERR, _("Could not construct interface name\n"));