]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Ensure pulse_connect() can never attempt to monitor fd -1
authorDavid Woodhouse <dwmw2@infradead.org>
Wed, 28 Apr 2021 12:26:54 +0000 (13:26 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Wed, 28 Apr 2021 12:26:54 +0000 (13:26 +0100)
Coverity wasn't sure that this could never happen. I'm *fairly* sure but
let's add a check anyway.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
pulse.c

diff --git a/pulse.c b/pulse.c
index 2e18c7d2df75d38a21de6fb0fe7f8275b65a0fd2..280cc4a3f65cdc978daccfd976c19438809cf703 100644 (file)
--- a/pulse.c
+++ b/pulse.c
@@ -2568,10 +2568,14 @@ int pulse_connect(struct openconnect_info *vpninfo)
 
        if (!vpninfo->ip_info.mtu ||
            (!vpninfo->ip_info.addr && !vpninfo->ip_info.addr6)) {
-               vpn_progress(vpninfo, PRG_ERR, "Insufficient configuration found\n");
+               vpn_progress(vpninfo, PRG_ERR, _("Insufficient configuration found\n"));
                return -EINVAL;
        }
 
+       /* This should never happen, but be defensive and shut Coverity up */
+       if (vpninfo->ssl_fd == -1)
+               return -EIO;
+
        ret = 0;
        monitor_fd_new(vpninfo, ssl);
        monitor_read_fd(vpninfo, ssl);