]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix a couple more Coverity-reported issues in tools.
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:51 +0000 (11:22 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:22:51 +0000 (11:22 -0700)
open-vm-tools/lib/include/vmGuestLib.h
open-vm-tools/lib/procMgr/procMgrPosix.c

index 9fe59c72105c29ba4d80a03861986fd253b129aa..b83f43cda64f8f3e0c4844559f7cf968d477d643 100644 (file)
@@ -469,7 +469,17 @@ VMGuestLib_StatGet(const char *encoding,  // IN
                    const char *stat,      // IN
                    char **reply,          // OUT
                    size_t *replySize);    // OUT
+/*
+ * To avoid a use after free error in SWIG-generated code, it is
+ * necessary to present SWIG with a modified function prototype
+ * for VMGuestLib_StatFree in which reply is of type "void *"
+ * rather than "char *."
+ */
+#ifndef        SWIG
 void VMGuestLib_StatFree(char *reply, size_t replySize);
+#else
+void VMGuestLib_StatFree(void *reply, size_t replySize);
+#endif
 
 #ifdef __cplusplus
 }
index dad6b2313a1b2fcc088d85ed2cf46ce3fcf84084..a572e864f935207ca434e4297bffe0ed3468a122 100644 (file)
@@ -1490,7 +1490,7 @@ ProcMgr_ExecAsync(char const *cmd,                 // IN: UTF-8 command line
    ProcMgr_AsyncProc *asyncProc = NULL;
    pid_t pid;
    int fds[2];
-   Bool validExitCode;
+   Bool validExitCode = FALSE;
    int exitCode;
    pid_t resultPid;
    int readFd, writeFd;