]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix double free in guestInfoServer.c.
authorKaty Feng <fkaty@vmware.com>
Thu, 16 Nov 2023 17:21:20 +0000 (09:21 -0800)
committerKaty Feng <fkaty@vmware.com>
Thu, 16 Nov 2023 17:21:20 +0000 (09:21 -0800)
Double free in "GuestInfoGather(gpointer data)" for osNameFullOverride.

open-vm-tools/services/plugins/guestInfo/guestInfoServer.c
open-vm-tools/tools.conf

index 9077e6b3e56b03587f87354829eebc409673bf4f..8ec1236e36db9e9073c3f6f9466178e71bf25a5b 100644 (file)
@@ -543,7 +543,7 @@ GuestInfoGather(gpointer data)
    int maxIPv4RoutesToGather;
    int maxIPv6RoutesToGather;
    gchar *osNameOverride;
-   gchar *osNameFullOverride;
+   gchar *osNameFullOverride = NULL;
    Bool maxNicsError = FALSE;
    static uint32 logThrottleCount = 0;
    Bool sendOsNames = FALSE;
@@ -570,19 +570,15 @@ GuestInfoGather(gpointer data)
                                             CONFGROUPNAME_GUESTOSINFO,
                                             CONFNAME_GUESTOSINFO_SHORTNAME,
                                             NULL);
-
-   osNameFullOverride = VMTools_ConfigGetString(ctx->config,
-                                                CONFGROUPNAME_GUESTOSINFO,
-                                                CONFNAME_GUESTOSINFO_LONGNAME,
-                                                NULL);
-   /* If only the OS Full Name is provided, continue as normal, but emit
-    * warning. */
-   if (osNameOverride == NULL && osNameFullOverride != NULL) {
-      g_warning("Ignoring " CONFNAME_GUESTOSINFO_LONGNAME " override.\n");
-      g_warning("To use the GOS name override, "
-                CONFNAME_GUESTOSINFO_SHORTNAME " must be present in the "
-                "tools.conf file.\n");
-      g_free(osNameFullOverride);
+   /*
+    * CONFNAME_GUESTINFO_LONGNAME is ignored if CONFNAME_GUESTINFO_SHORTNAME
+    * is not provided
+    */
+   if (osNameOverride) {
+      osNameFullOverride = VMTools_ConfigGetString(ctx->config,
+                                                   CONFGROUPNAME_GUESTOSINFO,
+                                                   CONFNAME_GUESTOSINFO_LONGNAME,
+                                                   NULL);
    }
 
    /* Gather all the relevant guest information. */
index 9a70c2d05d31a41454f6d560e731f3907fa2d01e..64cb844bdaf37fa3c0bc028cc8d8fb088e04385f 100644 (file)
 # Override the short OS name sent by tools.
 #short-name=
 
-# Override the long OS name sent by tools.
+# Override the long OS name sent by tools. Ignored if short-name is not set.
 #long-name=
 
 [vmbackup]