From: VMware, Inc <> Date: Tue, 26 Apr 2011 20:54:47 +0000 (-0700) Subject: Increase buffer size for OS name cache. X-Git-Tag: 2011.04.25-402641~46 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bb9ed1e2cb00cb6bc1fa5c7d21baa108a40a1e84;p=thirdparty%2Fopen-vm-tools.git Increase buffer size for OS name cache. Increase the scope of a previous fix to also cover long OS names, so that guest info and vix have enough buffer space to cover the max size supported by the hostinfo library. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/lib/include/guestInfo.h b/open-vm-tools/lib/include/guestInfo.h index 90dc999cb..bf8c23d55 100644 --- a/open-vm-tools/lib/include/guestInfo.h +++ b/open-vm-tools/lib/include/guestInfo.h @@ -51,6 +51,17 @@ #define GUEST_INFO_COMMAND "SetGuestInfo" #define MAX_VALUE_LEN 100 + +/** + * Upper bound for value sizes, based on gethostname(2): + * + * SUS2 guarantees that "Host names are limited to 255 bytes". + * + * We can't modify MAX_VALUE_LEN since it's used in wire-level definitions + * (such as PartitionEntry). + */ +#define GUESTINFO_MAX_VALUE_SIZE 256 + #define MAX_NICS 16 #define MAX_IPS 8 // Max number of IP addresses for a single NIC #define MAC_ADDR_SIZE 19 diff --git a/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c b/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c index 903725754..f783b5667 100644 --- a/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c +++ b/open-vm-tools/services/plugins/guestInfo/guestInfoServer.c @@ -65,17 +65,6 @@ VM_EMBED_VERSION(VMTOOLSD_VERSION_STRING); #endif - -/** - * Upper bound for value sizes, based on gethostname(2): - * - * SUS2 guarantees that "Host names are limited to 255 bytes". - * - * We can't modify MAX_VALUE_LEN since it's used in wire-level definitions - * (such as PartitionEntry). - */ -#define GUESTINFO_MAX_VALUE_SIZE 256 - MY_ASSERTS(GI_SIZE_ASSERTS, ASSERT_ON_COMPILE(GUESTINFO_MAX_VALUE_SIZE >= MAX_VALUE_LEN); ) diff --git a/open-vm-tools/services/plugins/vix/vixTools.c b/open-vm-tools/services/plugins/vix/vixTools.c index b3b9c7610..45d0a3b1f 100644 --- a/open-vm-tools/services/plugins/vix/vixTools.c +++ b/open-vm-tools/services/plugins/vix/vixTools.c @@ -1989,8 +1989,8 @@ VixTools_GetToolsPropertiesImpl(GKeyFile *confDictRef, // IN const char *powerOnScript = NULL; const char *resumeScript = NULL; const char *suspendScript = NULL; - char osNameFull[MAX_VALUE_LEN]; - char osName[MAX_VALUE_LEN]; + char osNameFull[GUESTINFO_MAX_VALUE_SIZE]; + char osName[GUESTINFO_MAX_VALUE_SIZE]; Bool foundHostName; char *tempDir = NULL; int wordSize = 32;