diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/filesystem.c --- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/filesystem.c 2018-06-23 03:03:28.000000000 -0700 +++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/filesystem.c 2019-02-02 17:32:36.382480084 -0800 @@ -123,8 +123,6 @@ HgfsOp opUsed, // IN: Op to be used. HgfsReq *req) // IN/OUT: Packet to write into { - char *name; - uint32 *nameLength; size_t requestSize; int result; @@ -134,14 +132,20 @@ case HGFS_OP_QUERY_VOLUME_INFO_V3: { HgfsRequestQueryVolumeV3 *requestV3 = HgfsGetRequestPayload(req); - /* We'll use these later. */ - name = requestV3->fileName.name; - nameLength = &requestV3->fileName.length; requestV3->fileName.flags = 0; requestV3->fileName.fid = HGFS_INVALID_HANDLE; requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE; requestV3->reserved = 0; requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize(); + /* Convert to CP name. */ + result = CPName_ConvertTo(path, + HGFS_LARGE_PACKET_MAX - (requestSize - 1), + requestV3->fileName.name); + if (result < 0) { + LOG(4, ("CP conversion failed.\n")); + return -EINVAL; + } + requestV3->fileName.length = (uint32) result; break; } case HGFS_OP_QUERY_VOLUME_INFO: { @@ -149,10 +153,16 @@ request = (HgfsRequestQueryVolume *)(HGFS_REQ_PAYLOAD(req)); - /* We'll use these later. */ - name = request->fileName.name; - nameLength = &request->fileName.length; requestSize = sizeof *request; + /* Convert to CP name. */ + result = CPName_ConvertTo(path, + HGFS_LARGE_PACKET_MAX - (requestSize - 1), + request->fileName.name); + if (result < 0) { + LOG(4, ("CP conversion failed.\n")); + return -EINVAL; + } + request->fileName.length = (uint32) result; break; } default: @@ -160,16 +170,6 @@ return -EPROTO; } - /* Convert to CP name. */ - result = CPName_ConvertTo(path, - HGFS_LARGE_PACKET_MAX - (requestSize - 1), - name); - if (result < 0) { - LOG(4, ("CP conversion failed.\n")); - return -EINVAL; - } - - *nameLength = (uint32) result; req->payloadSize = requestSize + result; /* Fill in header here as payloadSize needs to be there. */