]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
HgfsServer: Fix coverity issue - uninitialized variable "requestId"
authorOliver Kurth <okurth@vmware.com>
Mon, 17 Jun 2019 18:41:37 +0000 (11:41 -0700)
committerOliver Kurth <okurth@vmware.com>
Mon, 17 Jun 2019 18:41:37 +0000 (11:41 -0700)
Fix coverity uninitialized variable "requestId" by zeroing it
in HgfsServerGetRequest before passing to the request packet
HgfsUnpackPacketParams extraction function which will use it
in a log message.

Also moved an assert useful for testing protocol changes which was
incorrect in its placement.

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

index 295ab3c3f6d222e7adcc9b5ae336451c817fe51a..4622455110ae23e05439595641901a32b360265d 100644 (file)
@@ -3014,7 +3014,7 @@ HgfsServerGetRequest(HgfsPacket *packet,                        // IN: packet
    HgfsSessionInfo *session = NULL;
    uint64 sessionId = HGFS_INVALID_SESSION_ID;
    Bool sessionEnabled = FALSE;
-   uint32 requestId;
+   uint32 requestId = 0;
    HgfsOp opcode;
    const void *request;
    size_t requestSize;
@@ -3348,6 +3348,8 @@ HgfsServerSessionReceive(HgfsPacket *packet,      // IN: Hgfs Packet
    }
 
    HGFS_ASSERT_MINIMUM_OP(input->op);
+   HGFS_ASSERT_CLIENT(input->op);
+
    if (HGFS_ERROR_SUCCESS == status) {
       HGFS_ASSERT_INPUT(input);
       if ((input->op < ARRAYSIZE(handlers)) &&
@@ -3395,7 +3397,6 @@ HgfsServerSessionReceive(HgfsPacket *packet,      // IN: Hgfs Packet
                  __LINE__));
       }
    }
-   HGFS_ASSERT_CLIENT(input->op);
 
    /* Send error if we fail to process the op. */
    if (HGFS_ERROR_SUCCESS != status) {