Fixes for gcc 9 errors

This commit is contained in:
Ravindra Kumar 2019-02-03 00:20:24 -08:00
parent 0fa37d80bd
commit d2616b89bb
10 changed files with 1071 additions and 1 deletions

268
dir-aligned.patch Normal file
View File

@ -0,0 +1,268 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/dir.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/dir.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/dir.c 2019-02-02 23:40:26.945508336 -0800
@@ -54,8 +54,6 @@
HgfsOp opUsed, // IN: Op to be used
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *name;
- unsigned int *nameLength = NULL;
size_t reqSize;
int result;
@@ -66,14 +64,21 @@
case HGFS_OP_SEARCH_OPEN_V3: {
HgfsRequestSearchOpenV3 *requestV3 = HgfsGetRequestPayload(req);
- /* We'll use these later. */
- name = requestV3->dirName.name;
- nameLength = &requestV3->dirName.length;
requestV3->dirName.flags = 0;
requestV3->dirName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
requestV3->dirName.fid = HGFS_INVALID_HANDLE;
requestV3->reserved = 0;
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ requestV3->dirName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed\n"));
+ return -EINVAL;
+ }
+ LOG(4, ("After conversion = %s\n", requestV3->dirName.name));
+ requestV3->dirName.length = (uint32) result;
break;
}
@@ -82,10 +87,17 @@
request = (HgfsRequestSearchOpen *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- name = request->dirName.name;
- nameLength = &request->dirName.length;
reqSize = sizeof *request;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ request->dirName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed\n"));
+ return -EINVAL;
+ }
+ LOG(4, ("After conversion = %s\n", request->dirName.name));
+ request->dirName.length = (uint32) result;
break;
}
@@ -94,20 +106,6 @@
return -EPROTO;
}
- /* Convert to CP name. */
-
- LOG(4, ("After buildPath = %s\n", path));
- result = CPName_ConvertTo(path,
- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
- name);
- if (result < 0) {
- LOG(4, ("CP conversion failed\n"));
- return -EINVAL;
- }
-
- LOG(4, ("After conversion = %s\n", name));
-
- *nameLength = (uint32) result;
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */
@@ -149,7 +147,7 @@
int result;
HgfsOp opUsed;
HgfsStatus replyStatus;
- HgfsHandle *replySearch;
+ HgfsHandle replySearch;
ASSERT(path);
req = HgfsGetNewRequest();
@@ -164,12 +162,12 @@
if (opUsed == HGFS_OP_SEARCH_OPEN_V3) {
HgfsReplySearchOpenV3 *requestV3 = HgfsGetReplyPayload(req);
- replySearch = &requestV3->search;
+ replySearch = requestV3->search;
} else {
HgfsReplySearchOpen *request = (HgfsReplySearchOpen *)HGFS_REQ_PAYLOAD(req);
- replySearch = &request->search;
+ replySearch = request->search;
}
result = HgfsPackDirOpenRequest(path, opUsed, req);
@@ -187,8 +185,8 @@
switch (result) {
case 0:
- *handle = *replySearch;
- LOG(6, ("Set handle to %u\n", *replySearch));
+ *handle = replySearch;
+ LOG(6, ("Set handle to %u\n", replySearch));
break;
case -EPROTO:
/* Retry with older version(s). Set globally. */
@@ -626,8 +624,6 @@
HgfsOp opUsed, // IN: Op to be used.
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *fileName = NULL;
- uint32 *fileNameLength;
size_t reqSize;
int result;
@@ -638,13 +634,18 @@
HgfsRequestCreateDirV3 *requestV3 = HgfsGetRequestPayload(req);
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
- /* We'll use these later. */
- fileName = requestV3->fileName.name;
- fileNameLength = &requestV3->fileName.length;
requestV3->fileName.flags = 0;
requestV3->fileName.fid = HGFS_INVALID_HANDLE;
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
-
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ requestV3->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV3->fileName.length = result;
requestV3->mask = HGFS_CREATE_DIR_MASK;
/* Set permissions. */
@@ -660,11 +661,17 @@
requestV2 = (HgfsRequestCreateDirV2 *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- fileName = requestV2->fileName.name;
- fileNameLength = &requestV2->fileName.length;
reqSize = sizeof *requestV2;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ requestV2->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV2->fileName.length = result;
requestV2->mask = HGFS_CREATE_DIR_MASK;
/* Set permissions. */
@@ -679,11 +686,16 @@
request = (HgfsRequestCreateDir *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- fileName = request->fileName.name;
- fileNameLength = &request->fileName.length;
reqSize = sizeof *request;
-
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ request->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ request->fileName.length = result;
/* Set permissions. */
request->permissions = (permsMode & S_IRWXU) >> 6;
break;
@@ -693,17 +705,6 @@
return -EPROTO;
}
-
- /* Convert to CP name. */
- result = CPName_ConvertTo(path,
- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
- fileName);
- if (result < 0) {
- LOG(4, ("CP conversion failed.\n"));
- return -EINVAL;
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */
@@ -827,8 +828,6 @@
HgfsReq *req = NULL;
int result = 0;
HgfsStatus replyStatus;
- char *fileName = NULL;
- uint32 *fileNameLength;
uint32 reqSize;
HgfsOp opUsed;
HgfsAttrInfo newAttr = {0};
@@ -862,8 +861,16 @@
reqSize = sizeof(*request) + HgfsGetRequestHeaderSize();
request->hints = 0;
- fileName = request->fileName.name;
- fileNameLength = &request->fileName.length;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+ request->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ request->fileName.length = result;
request->fileName.fid = HGFS_INVALID_HANDLE;
request->fileName.flags = 0;
request->fileName.caseType = HGFS_FILE_NAME_DEFAULT_CASE;
@@ -874,23 +881,19 @@
request = (HgfsRequestDelete *)(HGFS_REQ_PAYLOAD(req));
/* Fill out the request packet. */
- fileName = request->fileName.name;
- fileNameLength = &request->fileName.length;
reqSize = sizeof *request;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+ request->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ request->fileName.length = result;
}
-
- /* Convert to CP name. */
- result = CPName_ConvertTo(path,
- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
- fileName);
- if (result < 0) {
- LOG(4, ("CP conversion failed.\n"));
- result = -EINVAL;
- goto out;
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */

369
file-aligned.patch Normal file
View File

@ -0,0 +1,369 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/file.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/file.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/file.c 2019-02-02 23:41:49.274822242 -0800
@@ -66,8 +66,6 @@
HgfsOp opUsed, // IN: Op to use
HgfsReq *req) // IN/OUT: Packet to write into
{
- char *name;
- uint32 *nameLength;
size_t reqSize;
int result;
int openMode, openFlags;
@@ -92,10 +90,16 @@
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
- /* We'll use these later. */
- name = requestV3->fileName.name;
- nameLength = &requestV3->fileName.length;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ requestV3->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV3->fileName.length = (uint32) result;
/* Linux clients need case-sensitive lookups. */
requestV3->fileName.flags = 0;
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -126,11 +130,18 @@
requestV2 = (HgfsRequestOpenV2 *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- name = requestV2->fileName.name;
- nameLength = &requestV2->fileName.length;
reqSize = sizeof *requestV2;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ requestV2->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+
+ requestV2->fileName.length = (uint32) result;
requestV2->mask = mask;
requestV2->mode = openMode;
requestV2->flags = openFlags;
@@ -151,11 +162,18 @@
HgfsRequestOpen *request;
request = (HgfsRequestOpen *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- name = request->fileName.name;
- nameLength = &request->fileName.length;
reqSize = sizeof *request;
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ HGFS_LARGE_PACKET_MAX - (reqSize - 1),
+ request->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+
+ request->fileName.length = (uint32) result;
request->mode = openMode;
request->flags = openFlags;
@@ -168,17 +186,6 @@
return -EPROTO;
}
-
- /* Convert to CP name. */
- result = CPName_ConvertTo(path,
- HGFS_LARGE_PACKET_MAX - (reqSize - 1),
- name);
- if (result < 0) {
- LOG(4, ("CP conversion failed.\n"));
- return -EINVAL;
- }
-
- *nameLength = (uint32) result;
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */
@@ -915,10 +922,6 @@
HgfsRename(const char* from, const char* to)
{
HgfsReq *req = NULL;
- char *oldName;
- char *newName;
- uint32 *oldNameLength;
- uint32 *newNameLength;
int result = 0;
uint32 reqSize;
HgfsOp opUsed;
@@ -942,33 +945,41 @@
if (opUsed == HGFS_OP_RENAME_V3) {
HgfsRequestRenameV3 *requestV3 = HgfsGetRequestPayload(req);
- oldName = requestV3->oldName.name;
- oldNameLength = &requestV3->oldName.length;
requestV3->hints = 0;
requestV3->oldName.flags = 0;
requestV3->oldName.fid = HGFS_INVALID_HANDLE;
requestV3->oldName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
requestV3->reserved = 0;
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
+ /* Convert old name to CP format. */
+ result = CPName_ConvertTo(from,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+ requestV3->oldName.name);
+ if (result < 0) {
+ LOG(4, ("oldName CP conversion failed\n"));
+ result = -EINVAL;
+ goto out;
+ }
+
+ requestV3->oldName.length = result;
+ reqSize += result;
} else {
HgfsRequestRename *request = (HgfsRequestRename *)HGFS_REQ_PAYLOAD(req);
- oldName = request->oldName.name;
- oldNameLength = &request->oldName.length;
reqSize = sizeof *request;
- }
- /* Convert old name to CP format. */
- result = CPName_ConvertTo(from,
- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
- oldName);
- if (result < 0) {
- LOG(4, ("oldName CP conversion failed\n"));
- result = -EINVAL;
- goto out;
- }
+ /* Convert old name to CP format. */
+ result = CPName_ConvertTo(from,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize),
+ request->oldName.name);
+ if (result < 0) {
+ LOG(4, ("oldName CP conversion failed\n"));
+ result = -EINVAL;
+ goto out;
+ }
- *oldNameLength = result;
- reqSize += result;
+ request->oldName.length = result;
+ reqSize += result;
+ }
/*
* Build full new name to send to server.
@@ -983,8 +994,20 @@
newNameP = (HgfsFileNameV3 *)((char *)&requestV3->oldName +
sizeof requestV3->oldName + result);
- newName = newNameP->name;
- newNameLength = &newNameP->length;
+
+ LOG(6, ("New name: \"%s\"\n", newNameP->name));
+
+ /* Convert new name to CP format. */
+ result = CPName_ConvertTo(to,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
+ newNameP->name);
+ if (result < 0) {
+ LOG(4, ("newName CP conversion failed\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ newNameP->length = result;
+ reqSize += result;
newNameP->flags = 0;
newNameP->fid = HGFS_INVALID_HANDLE;
newNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -993,24 +1016,22 @@
HgfsFileName *newNameP;
newNameP = (HgfsFileName *)((char *)&request->oldName +
sizeof request->oldName + result);
- newName = newNameP->name;
- newNameLength = &newNameP->length;
- }
- LOG(6, ("New name: \"%s\"\n", newName));
+ LOG(6, ("New name: \"%s\"\n", newNameP->name));
- /* Convert new name to CP format. */
- result = CPName_ConvertTo(to,
- HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
- newName);
- if (result < 0) {
- LOG(4, ("newName CP conversion failed\n"));
- result = -EINVAL;
- goto out;
+ /* Convert new name to CP format. */
+ result = CPName_ConvertTo(to,
+ HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize) - result,
+ newNameP->name);
+ if (result < 0) {
+ LOG(4, ("newName CP conversion failed\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ newNameP->length = result;
+ reqSize += result;
}
- *newNameLength = result;
- reqSize += result;
req->payloadSize = reqSize;
/* Fill in header here as payloadSize needs to be there. */
@@ -1109,10 +1130,7 @@
{
HgfsAttrV2 *attrV2;
HgfsAttr *attrV1;
- HgfsAttrHint *hints;
HgfsAttrChanges *update;
- char *fileName = NULL;
- uint32 *fileNameLength = NULL;
size_t reqBufferSize;
size_t reqSize;
int result = 0;
@@ -1123,7 +1141,6 @@
HgfsRequestSetattrV3 *requestV3 = HgfsGetRequestPayload(req);
attrV2 = &requestV3->attr;
- hints = &requestV3->hints;
/*
* Clear attributes, mask, and hints before touching them.
@@ -1131,7 +1148,7 @@
* make sure to zero them all here.
*/
memset(attrV2, 0, sizeof *attrV2);
- memset(hints, 0, sizeof *hints);
+ requestV3->hints = 0;
/*
* When possible, issue a setattr using an existing handle. This will
@@ -1143,14 +1160,20 @@
* the times also requires write permissions on Windows, so we require it
* here too. Otherwise, any handle will do.
*/
- fileName = requestV3->fileName.name;
- fileNameLength = &requestV3->fileName.length;
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
requestV3->fileName.fid = HGFS_INVALID_HANDLE;
requestV3->fileName.flags = 0;
requestV3->reserved = 0;
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ requestV3->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV3->fileName.length = result;
attrV2->mask = attr->mask;
if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
@@ -1173,11 +1196,11 @@
}
if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
attrV2->accessTime = attr->accessTime;
- *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
+ requestV3->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
}
if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) {
attrV2->writeTime = attr->writeTime;
- *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
+ requestV3->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
}
break;
@@ -1188,7 +1211,6 @@
requestV2 = (HgfsRequestSetattrV2 *)(HGFS_REQ_PAYLOAD(req));
attrV2 = &requestV2->attr;
- hints = &requestV2->hints;
/*
* Clear attributes, mask, and hints before touching them.
@@ -1196,13 +1218,18 @@
* make sure to zero them all here.
*/
memset(attrV2, 0, sizeof *attrV2);
- memset(hints, 0, sizeof *hints);
-
- fileName = requestV2->fileName.name;
- fileNameLength = &requestV2->fileName.length;
+ requestV2->hints = 0;
reqSize = sizeof *requestV2;
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ requestV2->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV2->fileName.length = result;
if (attr->mask & (HGFS_ATTR_VALID_SPECIAL_PERMS |
HGFS_ATTR_VALID_OWNER_PERMS |
@@ -1224,11 +1251,11 @@
}
if (attr->mask & HGFS_ATTR_VALID_ACCESS_TIME) {
attrV2->accessTime = attr->accessTime;
- *hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
+ requestV2->hints |= HGFS_ATTR_HINT_SET_ACCESS_TIME;
}
if (attr->mask & HGFS_ATTR_VALID_WRITE_TIME) {
attrV2->writeTime = attr->writeTime;
- *hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
+ requestV2->hints |= HGFS_ATTR_HINT_SET_WRITE_TIME;
}
break;
@@ -1241,11 +1268,16 @@
attrV1 = &request->attr;
update = &request->update;
- /* We'll use these later. */
- fileName = request->fileName.name;
- fileNameLength = &request->fileName.length;
reqSize = sizeof *request;
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, request);
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ request->fileName.name);
+ if (result < 0) {
+ LOG(4, ("CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ request->fileName.length = result;
/*
* Clear attributes before touching them.
@@ -1284,15 +1316,6 @@
return -EPROTO;
}
- result = CPName_ConvertTo(path,
- reqBufferSize,
- fileName);
- if (result < 0) {
- LOG(4, ("CP conversion failed.\n"));
- return -EINVAL;
- }
-
- *fileNameLength = result;
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */

73
filesystem-aligned.patch Normal file
View File

@ -0,0 +1,73 @@
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. */

109
fsutil-aligned.patch Normal file
View File

@ -0,0 +1,109 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/fsutil.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/fsutil.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/fsutil.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/fsutil.c 2019-02-02 22:42:45.458832655 -0800
@@ -189,8 +189,6 @@
size_t reqBufferSize;
size_t reqSize;
int result = 0;
- char *fileName = NULL;
- uint32 *fileNameLength = NULL;
ASSERT(attr);
ASSERT(req);
ASSERT(path);
@@ -204,8 +202,6 @@
/* Fill out the request packet. */
requestV3->hints = 0;
- fileName = requestV3->fileName.name;
- fileNameLength = &requestV3->fileName.length;
requestV3->fileName.flags = 0;
requestV3->fileName.fid = HGFS_INVALID_HANDLE;
requestV3->fileName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -213,6 +209,19 @@
requestV3->reserved = 0;
reqSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
reqBufferSize = HGFS_NAME_BUFFER_SIZET(HGFS_LARGE_PACKET_MAX, reqSize);
+ if (requestV3->fileName.name != NULL) {
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ requestV3->fileName.name);
+ LOG(8, ("Converted path %s\n", requestV3->fileName.name));
+ if (result < 0) {
+ LOG(8, ("CP conversion failed.\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ requestV3->fileName.length = result;
+ }
break;
}
@@ -223,20 +232,42 @@
requestV2 = (HgfsRequestGetattrV2 *)(HGFS_REQ_PAYLOAD(req));
requestV2->hints = 0;
- fileName = requestV2->fileName.name;
- fileNameLength = &requestV2->fileName.length;
reqSize = sizeof *requestV2;
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV2);
+ if (requestV2->fileName.name != NULL) {
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ requestV2->fileName.name);
+ LOG(8, ("Converted path %s\n", requestV2->fileName.name));
+ if (result < 0) {
+ LOG(8, ("CP conversion failed.\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ requestV2->fileName.length = result;
+ }
break;
}
case HGFS_OP_GETATTR: {
HgfsRequestGetattr *requestV1;
requestV1 = (HgfsRequestGetattr *)(HGFS_REQ_PAYLOAD(req));
- fileName = requestV1->fileName.name;
- fileNameLength = &requestV1->fileName.length;
reqSize = sizeof *requestV1;
reqBufferSize = HGFS_NAME_BUFFER_SIZE(HGFS_LARGE_PACKET_MAX, requestV1);
+ if (requestV1->fileName.name != NULL) {
+ /* Convert to CP name. */
+ result = CPName_ConvertTo(path,
+ reqBufferSize,
+ requestV1->fileName.name);
+ LOG(8, ("Converted path %s\n", requestV1->fileName.name));
+ if (result < 0) {
+ LOG(8, ("CP conversion failed.\n"));
+ result = -EINVAL;
+ goto out;
+ }
+ requestV1->fileName.length = result;
+ }
break;
}
@@ -246,20 +277,6 @@
goto out;
}
- if (fileName != NULL) {
- /* Convert to CP name. */
- result = CPName_ConvertTo(path,
- reqBufferSize,
- fileName);
- LOG(8, ("Converted path %s\n", fileName));
- if (result < 0) {
- LOG(8, ("CP conversion failed.\n"));
- result = -EINVAL;
- goto out;
- }
- *fileNameLength = result;
- }
-
req->payloadSize = reqSize + result;
/* Fill in header here as payloadSize needs to be there. */

30
hgfsServer-aligned.patch Normal file
View File

@ -0,0 +1,30 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c open-vm-tools-10.3.0-8931395/lib/hgfsServer/hgfsServer.c
--- open-vm-tools-10.3.0-8931395-orig/lib/hgfsServer/hgfsServer.c 2018-06-23 03:04:02.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/lib/hgfsServer/hgfsServer.c 2019-02-02 14:11:19.537039738 -0800
@@ -6536,9 +6536,11 @@
payload = &reply->payload[0];
}
if (payload) {
+ uint32 actualSize = 0;
status = HgfsPlatformReadFile(readFd, input->session, offset,
requiredSize, payload,
- &reply->actualSize);
+ &actualSize);
+ reply->actualSize = actualSize;
if (HGFS_ERROR_SUCCESS == status) {
reply->reserved = 0;
replyPayloadSize = sizeof *reply;
@@ -6556,10 +6558,12 @@
break;
}
case HGFS_OP_READ: {
+ uint32 actualSize = 0;
HgfsReplyRead *reply = replyRead;
status = HgfsPlatformReadFile(readFd, input->session, offset, requiredSize,
- reply->payload, &reply->actualSize);
+ reply->payload, &actualSize);
+ reply->actualSize = actualSize;
if (HGFS_ERROR_SUCCESS == status) {
replyPayloadSize = sizeof *reply + reply->actualSize;
} else {

35
hgfsmounter-aligned.patch Normal file
View File

@ -0,0 +1,35 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/hgfsmounter/hgfsmounter.c open-vm-tools-10.3.0-8931395/hgfsmounter/hgfsmounter.c
--- open-vm-tools-10.3.0-8931395-orig/hgfsmounter/hgfsmounter.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/hgfsmounter/hgfsmounter.c 2019-02-02 15:22:17.639393841 -0800
@@ -514,11 +514,13 @@
HgfsMountInfo *mountInfo, // OUT: mount data
int *flags) // OUT: mount flags
{
+ unsigned short fmask = 0;
ASSERT(option);
ASSERT(mountInfo);
- if (ParseMask(option, &mountInfo->fmask)) {
- LOG("Setting mount fmask to %o\n", mountInfo->fmask);
+ if (ParseMask(option, &fmask)) {
+ LOG("Setting mount fmask to %o\n", fmask);
+ mountInfo->fmask = fmask;
return TRUE;
}
@@ -548,11 +550,13 @@
HgfsMountInfo *mountInfo, // OUT: mount data
int *flags) // OUT: mount flags
{
+ unsigned short dmask = 0;
ASSERT(option);
ASSERT(mountInfo);
- if (ParseMask(option, &mountInfo->dmask)) {
- LOG("Setting mount dmask to %o\n", mountInfo->dmask);
+ if (ParseMask(option, &dmask)) {
+ LOG("Setting mount dmask to %o\n", dmask);
+ mountInfo->dmask = dmask;
return TRUE;
}

123
link-aligned.patch Normal file
View File

@ -0,0 +1,123 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c open-vm-tools-10.3.0-8931395/vmhgfs-fuse/link.c
--- open-vm-tools-10.3.0-8931395-orig/vmhgfs-fuse/link.c 2018-06-23 03:03:28.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/vmhgfs-fuse/link.c 2019-02-03 00:07:18.555759499 -0800
@@ -51,12 +51,7 @@
{
HgfsRequestSymlinkCreateV3 *requestV3 = NULL;
HgfsRequestSymlinkCreate *request = NULL;
- char *symlinkName;
- uint32 *symlinkNameLength;
- char *targetName;
- uint32 *targetNameLength;
size_t targetNameBytes;
-
size_t requestSize;
int result;
@@ -64,23 +59,35 @@
case HGFS_OP_CREATE_SYMLINK_V3: {
requestV3 = HgfsGetRequestPayload(req);
- /* We'll use these later. */
- symlinkName = requestV3->symlinkName.name;
- symlinkNameLength = &requestV3->symlinkName.length;
requestV3->symlinkName.flags = 0;
requestV3->symlinkName.fid = HGFS_INVALID_HANDLE;
requestV3->symlinkName.caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
requestV3->reserved = 0;
requestSize = sizeof(*requestV3) + HgfsGetRequestHeaderSize();
+ /* Convert symlink name to CP format. */
+ result = CPName_ConvertTo(symlink,
+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+ requestV3->symlinkName.name);
+ if (result < 0) {
+ LOG(4, ("SymlinkName CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ requestV3->symlinkName.length = result;
break;
}
case HGFS_OP_CREATE_SYMLINK: {
request = (HgfsRequestSymlinkCreate *)(HGFS_REQ_PAYLOAD(req));
- /* We'll use these later. */
- symlinkName = request->symlinkName.name;
- symlinkNameLength = &request->symlinkName.length;
requestSize = sizeof *request;
+ /* Convert symlink name to CP format. */
+ result = CPName_ConvertTo(symlink,
+ HGFS_LARGE_PACKET_MAX - (requestSize - 1),
+ request->symlinkName.name);
+ if (result < 0) {
+ LOG(4, ("SymlinkName CP conversion failed.\n"));
+ return -EINVAL;
+ }
+ request->symlinkName.length = result;
break;
}
default:
@@ -88,19 +95,10 @@
return -EPROTO;
}
-
- /* Convert symlink name to CP format. */
- result = CPName_ConvertTo(symlink,
- HGFS_LARGE_PACKET_MAX - (requestSize - 1),
- symlinkName);
- if (result < 0) {
- LOG(4, ("SymlinkName CP conversion failed.\n"));
- return -EINVAL;
- }
-
- *symlinkNameLength = result;
req->payloadSize = requestSize + result;
+ targetNameBytes = strlen(symname) + 1;
+
/*
* Note the different buffer length. This is because HgfsRequestSymlink
* contains two filenames, and once we place the first into the packet we
@@ -115,8 +113,11 @@
HgfsFileNameV3 *fileNameP;
fileNameP = (HgfsFileNameV3 *)((char *)&requestV3->symlinkName +
sizeof requestV3->symlinkName + result);
- targetName = fileNameP->name;
- targetNameLength = &fileNameP->length;
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
fileNameP->flags = 0;
fileNameP->fid = HGFS_INVALID_HANDLE;
fileNameP->caseType = HGFS_FILE_NAME_CASE_SENSITIVE;
@@ -124,23 +125,19 @@
HgfsFileName *fileNameP;
fileNameP = (HgfsFileName *)((char *)&request->symlinkName +
sizeof request->symlinkName + result);
- targetName = fileNameP->name;
- targetNameLength = &fileNameP->length;
+ memcpy(fileNameP->name, symname, targetNameBytes);
+ LOG(6, ("Target name: \"%s\"\n", fileNameP->name));
+ /* Convert target name to CPName-lite format. */
+ CPNameLite_ConvertTo(fileNameP->name, targetNameBytes - 1, '/');
+ fileNameP->length = targetNameBytes - 1;
}
- targetNameBytes = strlen(symname) + 1;
/* Copy target name into request packet. */
if (targetNameBytes > HGFS_LARGE_PACKET_MAX - (requestSize - 1)) {
LOG(4, ("Target name is too long.\n"));
return -EINVAL;
}
- memcpy(targetName, symname, targetNameBytes);
- LOG(6, ("Target name: \"%s\"\n", targetName));
-
- /* Convert target name to CPName-lite format. */
- CPNameLite_ConvertTo(targetName, targetNameBytes - 1, '/');
- *targetNameLength = targetNameBytes - 1;
req->payloadSize += targetNameBytes - 1;
/* Fill in header here as payloadSize needs to be there. */

View File

@ -0,0 +1,29 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/libDeployPkg/linuxDeploymentUtilities.c open-vm-tools-10.3.0-8931395/libDeployPkg/linuxDeploymentUtilities.c
--- open-vm-tools-10.3.0-8931395-orig/libDeployPkg/linuxDeploymentUtilities.c 2018-06-23 03:04:54.000000000 -0700
+++ open-vm-tools-10.3.0-8931395/libDeployPkg/linuxDeploymentUtilities.c 2019-02-02 15:45:50.228320875 -0800
@@ -102,7 +102,6 @@
HasCustomScript(const char* dirPath, char** scriptName)
{
bool hasScript = false;
- size_t scriptSize;
static const char *customScriptRegex = "^script[A-Za-z0-9]*\\.bat";
DIR *tempDir;
struct dirent *dir;
@@ -124,16 +123,13 @@
}
while ((dir = readdir(tempDir)) != NULL) {
if (!regexec(&scriptRegex, dir->d_name, 0, NULL, 0)) {
- scriptSize = strlen(dir->d_name);
- *scriptName = malloc(sizeof(char) * scriptSize + 1);
+ *scriptName = strdup(dir->d_name);
if (*scriptName == NULL) {
sLog(log_warning, "Could not allocate memory for scriptName: %s",
strerror(errno));
closedir(tempDir);
goto done;
}
- **scriptName = '\0';
- strncat(*scriptName, dir->d_name, scriptSize);
hasScript = true;
}
}

View File

@ -28,7 +28,7 @@
Name: open-vm-tools
Version: %{toolsversion}
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Open Virtual Machine Tools for virtual machines hosted on VMware
License: GPLv2
URL: https://github.com/vmware/%{name}
@ -46,6 +46,15 @@ ExclusiveArch: %{ix86} x86_64
Patch1: cloud-init.patch
Patch2: hgfsPlugin-crash.patch
Patch3: hgfsServer-aligned.patch
Patch4: util-misc-format.patch
Patch5: hgfsmounter-aligned.patch
Patch6: linuxDeploymentUtils-strncat.patch
Patch7: filesystem-aligned.patch
Patch8: file-aligned.patch
Patch9: fsutil-aligned.patch
Patch10: dir-aligned.patch
Patch11: link-aligned.patch
BuildRequires: autoconf
BuildRequires: automake
@ -322,6 +331,17 @@ fi
%{_bindir}/vmware-vgauth-smoketest
%changelog
* Sun Feb 03 2019 Ravindra Kumar <ravindrakumar@vmware.com> - 10.3.0-7
- Added hgfsServer-aligned.patch for "address-of-packed-member" error.
- Added hgfsmounter-aligned.patch for "address-of-packed-member" error.
- Added util-misc-format.patch for "format-overflow" error.
- Added linuxDeploymentUtils-strncat.patch for "stringop-truncation" error.
- Added filesystem-aligned.patch for "address-of-packed-member" error.
- Added file-aligned.patch for "address-of-packed-member" error.
- Added fsutil-aligned.patch for "address-of-packed-member" error.
- Added dir-aligned.patch for "address-of-packed-member" error.
- Added link-aligned.patch for "address-of-packed-member" error.
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 10.3.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

14
util-misc-format.patch Normal file
View File

@ -0,0 +1,14 @@
diff -ru open-vm-tools-10.3.0-8931395-orig/lib/misc/util_misc.c open-vm-tools-10.3.0-8931395/lib/misc/util_misc.c
--- open-vm-tools-10.3.0-8931395-orig/lib/misc/util_misc.c 2019-02-02 15:01:18.930886338 -0800
+++ open-vm-tools-10.3.0-8931395/lib/misc/util_misc.c 2019-02-02 15:01:33.506404000 -0800
@@ -719,8 +719,8 @@
ASSERT(!freeChunk[i]);
chunks[i] = expand;
if (chunks[i] == NULL) {
- Log("%s: Cannot allocate memory to expand \"%s\" in \"%s\".\n",
- __FUNCTION__, expand, fileName);
+ Log("%s: Cannot allocate memory to expand $ in \"%s\".\n",
+ __FUNCTION__, fileName);
goto out;
}
chunkSize[i] = strlen(expand);