From: Oliver Kurth Date: Tue, 19 Feb 2019 20:51:32 +0000 (-0800) Subject: Common source file changes not applicable to open-vm-tools. X-Git-Tag: stable-11.0.0~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43ba436554ee51d8d7e40a7e86618bd634292356;p=thirdparty%2Fopen-vm-tools.git Common source file changes not applicable to open-vm-tools. --- diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h index 168c32a5e..c64869d54 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dnd.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dnd.h @@ -52,9 +52,15 @@ extern "C" { #define DND_MAX_PATH 6144 #define DNDMSG_HEADERSIZE_V3 ((3 * sizeof (uint32)) + (1 * sizeof (uint8))) -/* Hard limits we never want to exceed */ -/* The maximum size of a serializied DnDMsg. Close to 4M. */ +/* + * Hard limits we never want to exceed. The maximum size of a serializied + * DnDMsg. Close to 4M for Workstion/Fusion, 4G for Horzion. + */ +#ifdef VMX86_HORIZON_VIEW +#define DNDMSG_MAX_ARGSZ (0xffffffff - DNDMSG_HEADERSIZE_V3) +#else #define DNDMSG_MAX_ARGSZ ((1 << 22) - DNDMSG_HEADERSIZE_V3) +#endif /* The maximum number of arguments we can hold */ #define DNDMSG_MAX_ARGS 64 diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.c b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.c index 3a907947d..39b2638a2 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.c +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2017 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -67,14 +67,17 @@ DnDCPMsgV4IsPacketValid(const uint8 *packet, return FALSE; } - /* Payload should be smaller than the whole binary + /* + * For Workstation/Fusion Payload should be smaller than the whole binary * and should not be put beyond the binary tail. * * binarySize should be smaller than DND_CP_MSG_MAX_BINARY_SIZE_V4, so that * integer overflow is not possible since DND_CP_MSG_MAX_BINARY_SIZE_V4 * 2 - * is guaranteed to be less than MAX_UINT32. + * is guaranteed to be less than MAX_UINT32. Horizon removes this limitation */ +#ifndef VMX86_HORIZON_VIEW ASSERT_ON_COMPILE(DND_CP_MSG_MAX_BINARY_SIZE_V4 <= MAX_UINT32 / 2); +#endif if (msgHdr->payloadOffset > msgHdr->binarySize || msgHdr->payloadSize > msgHdr->binarySize || msgHdr->payloadOffset + msgHdr->payloadSize > msgHdr->binarySize) { diff --git a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h index 765c081fc..bd4fc94b6 100644 --- a/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h +++ b/open-vm-tools/services/plugins/dndcp/dnd/dndCPMsgV4.h @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2019 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -218,7 +218,16 @@ DnDCPMsgHdrV4; #define DND_CP_MSG_HEADERSIZE_V4 (sizeof (DnDCPMsgHdrV4)) #define DND_CP_PACKET_MAX_PAYLOAD_SIZE_V4 (DND_MAX_TRANSPORT_PACKET_SIZE - \ DND_CP_MSG_HEADERSIZE_V4) +#ifdef VMX86_HORIZON_VIEW +/* + * Horizon has no hard limit, but the size field is type of uint32, + * 4G-1(0xffffffff) is the maximum size represented. + */ +#define DND_CP_MSG_MAX_BINARY_SIZE_V4 0xffffffff +#else +// Workstation/fusion have hard limit in size(4M) of DnD Msg, refer to dnd.h #define DND_CP_MSG_MAX_BINARY_SIZE_V4 (1 << 22) +#endif /* DnD version 4 message. */ typedef struct DnDCPMsgV4 {