From: Oliver Kurth Date: Mon, 17 Jun 2019 18:41:37 +0000 (-0700) Subject: HgfsServer: Fix coverity issue - uninitialized variable "requestId" X-Git-Tag: stable-11.0.0~40 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e1d3be7c075e8ca4c7ff07b8dadeab8a14953b3;p=thirdparty%2Fopen-vm-tools.git 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. --- 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) {