From 9e1d3be7c075e8ca4c7ff07b8dadeab8a14953b3 Mon Sep 17 00:00:00 2001 From: Oliver Kurth Date: Mon, 17 Jun 2019 11:41:37 -0700 Subject: [PATCH] HgfsServer: Fix coverity issue - uninitialized variable "requestId" 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 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/open-vm-tools/lib/hgfsServer/hgfsServer.c b/open-vm-tools/lib/hgfsServer/hgfsServer.c index 295ab3c3f..462245511 100644 --- a/open-vm-tools/lib/hgfsServer/hgfsServer.c +++ b/open-vm-tools/lib/hgfsServer/hgfsServer.c @@ -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) { -- 2.47.3