]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix NULL pointer dereference and remove three lines of dead code.
authorOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:47 +0000 (13:19 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 18 Dec 2018 21:19:47 +0000 (13:19 -0800)
QbitLogic has run [Code]Ai on the open-vm-tools source code and
and notified VMware of a potential NULL pointer reference and four
pieces of dead code.

See https://github.com/vmware/open-vm-tools/pull/247

bora-vmsoft/services/vmtoolsd/pluginMgr.c
The proposed fix conditionally emitted a log message.  That fix has
been reworked to consistently emit a log message with conditional
content.

bora/lib/misc/posixPosix.c
bora-vmsoft/apps/toolbox-cmd/toolboxcmd-shrink.c
Remove one line of dead code from each source file.

bora-vmsoft/lib/procMgr/procMgrPosix.c:
Suggested dead code fix actually pointed to a bug where errno
was not getting updated as intended.

bora-vmsoft/services/plugins/guestInfo/perfMonLinux.c:
Suggested dead code is no longer dead; change not applicable.

open-vm-tools/AUTHORS
open-vm-tools/lib/misc/posixPosix.c
open-vm-tools/lib/procMgr/procMgrPosix.c
open-vm-tools/services/vmtoolsd/pluginMgr.c
open-vm-tools/toolbox/toolboxcmd-shrink.c

index 6c64a50057978d57786063c639f92afd76b299ff..b5a26ddf4d978b734f6de486bba23f3b640b1720 100644 (file)
@@ -42,3 +42,7 @@ John Eismeier   Propose fix some spelling.
 
 Josh Paetzel    Additional changes to vmmemctl.ko for FreeBSD 12.0 API changes.
                 - https://github.com/vmware/open-vm-tools/pull/286
+
+[Code]Ai        Highlighted a potential NULL pointer dereference and four
+                pieces of dead code.
+                - https://github.com/vmware/open-vm-tools/pull/247
index 562ffa4ee594bca0270f1ff2e0332ea30dcd82db..2c1c278e7b36ede2ba1febff9e6e6322a1cf7a73 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 2008-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 2008-2018 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
@@ -2111,7 +2111,6 @@ Posix_Getmntent_r(FILE *fp,          // IN:
          goto exit;
       }
       m->mnt_opts = memcpy(buf + n, opts, len);
-      n += len;
    }
    ret = 0;
 
index a52456b559f3e9818112dc09be87e9d4ad1da225..d07b5d3ffea7cc8580d3013eeb268748a130d1d4 100644 (file)
@@ -1,5 +1,5 @@
 /*********************************************************
- * Copyright (C) 1998-2017 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2018 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
@@ -2206,7 +2206,7 @@ ProcMgr_ImpersonateUserStart(const char *user,  // IN: UTF-8 encoded user name
        * according to POSIX 1003.1-2003, so patch up the errno.
        */
       if (error == 0) {
-         error = ENOENT;
+         errno = ENOENT;
       }
       return FALSE;
    }
index bee05e46fb5a789e26b0defe240e509bb7dcdce0..697e36991ec4218e606277d4897fe10b4cffd9f5 100644 (file)
@@ -922,7 +922,8 @@ ToolsCore_UnloadPlugins(ToolsServiceState *state)
       ToolsPlugin *plugin = g_ptr_array_index(state->plugins, state->plugins->len - 1);
       GArray *regs = (plugin->data != NULL) ? plugin->data->regs : NULL;
 
-      g_message("Unloading plugin '%s'.\n", plugin->data->name);
+      g_message("Unloading plugin '%s'.\n",
+                plugin->data != NULL ? plugin->data->name : "unknown");
 
       if (regs != NULL) {
          guint i;
index 4e3e72472c876d22c0bd81d8f05769dae1e5f664..39c0a923cc6baadadb4b48d2ccae5cd8edacb61f 100644 (file)
@@ -443,8 +443,6 @@ ShrinkDoWipeAndShrink(char *mountPoint,         // IN: mount point
          } else {
             ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), err);
          }
-
-         rc = EX_TEMPFAIL;
          break;
       }