]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Correct an issue reported by Coverity.
authorOliver Kurth <okurth@vmware.com>
Fri, 12 Jun 2020 03:43:20 +0000 (20:43 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 12 Jun 2020 03:43:20 +0000 (20:43 -0700)
lib/asyncsocket/asyncsocket.c:
 - AsyncSocket_SetKeepAlive() calls AsyncSocket_GetFd() which may return
   a negative result.  If that should happen, simply return FALSE.

open-vm-tools/lib/asyncsocket/asyncsocket.c

index 76c3343bda3e95c5468ec2cf8c7b870f365843f3..715f6d1d7612ff2d6be5d4e4457972739451cdc4 100644 (file)
@@ -6441,6 +6441,10 @@ AsyncSocket_SetKeepAlive(AsyncSocket *asock, // IN
    int fd;
 
    fd = AsyncSocket_GetFd(asock);
+   if (fd < 0) {
+      Log(ASOCKPREFIX "(%p) is not valid.\n", asock);
+      return FALSE;
+   }
 #ifdef WIN32
    {
       struct tcp_keepalive keepalive = { 1, keepIdle * 1000, keepIdle * 10 };