]> 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, 29 Jan 2019 22:03:18 +0000 (14:03 -0800)
committerOliver Kurth <okurth@vmware.com>
Tue, 29 Jan 2019 22:03:18 +0000 (14:03 -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 9c57831860a3e7d2fbaf5d1e8bdafa702727567f..ff87a57b53c2acd15a845b9d39cae3955809298e 100644 (file)
@@ -36,3 +36,7 @@ Ed Schouten     Use standard SYSCTL_ADD_OID() macro to access the
 
 Steve Wills     Fix vmmemctl.ko driver build for supported FreeBSD releases.
                 - https://github.com/vmware/open-vm-tools/pull/140
+
+[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 8774fa43793a62709f4e05d6aa26abb708f867ee..b6896a3d9c01368896fe80e26526d68cb45448c6 100644 (file)
@@ -438,8 +438,6 @@ ShrinkDoWipeAndShrink(char *mountPoint,         // IN: mount point
          } else {
             ToolsCmd_PrintErr(SU_(error.message, "Error: %s\n"), err);
          }
-
-         rc = EX_TEMPFAIL;
          break;
       }