From: Oliver Kurth Date: Fri, 12 Jun 2020 03:43:20 +0000 (-0700) Subject: Correct an issue reported by Coverity. X-Git-Tag: stable-11.2.0~150 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1669fe0b0c0161884f19bcce257e0b10328c14c6;p=thirdparty%2Fopen-vm-tools.git Correct an issue reported by Coverity. lib/asyncsocket/asyncsocket.c: - AsyncSocket_SetKeepAlive() calls AsyncSocket_GetFd() which may return a negative result. If that should happen, simply return FALSE. --- diff --git a/open-vm-tools/lib/asyncsocket/asyncsocket.c b/open-vm-tools/lib/asyncsocket/asyncsocket.c index 76c3343bd..715f6d1d7 100644 --- a/open-vm-tools/lib/asyncsocket/asyncsocket.c +++ b/open-vm-tools/lib/asyncsocket/asyncsocket.c @@ -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 };