]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fixes for issues found in Coverity scan.
authorKruti <kpendharkar@vmware.com>
Fri, 7 Jun 2024 16:55:03 +0000 (09:55 -0700)
committerKruti <kpendharkar@vmware.com>
Fri, 7 Jun 2024 16:55:03 +0000 (09:55 -0700)
vgauth/serviceImpl/saml-xmlsec1.c
issue: 'string_null' for strlen(pemCert)
impact: False-positive
fix: suppress 'string_null'
issue: leaked_storage: certChain is not cleaned up on error.
impact: Memory is leaked on the error path.
fix: Add line before return to free certChain.

vgauth/common/i18n.c
issue: 'leaked_storage' for "name" variable
impact: False-positive
fix: suppress 'leaked_storage'

lib/file/file.c
issue: use_after_free for 'src' pointer
impact: False-positive
fix: suppress 'use_after_free'

services/plugins/serviceDiscovery/serviceDiscovery.c
issue: overrun-local: gdpErrMsgs array contains one less entry then there are
       enum defined.
impact: Valid but the function never return the GDP_ERR_MAX enum.
fix: in gdp.h, add an error entry for GDP_ERR_MAX this way gdpErrMsgs will
generate all entries.

lib/file/fileLockPosix.c
issue: string_null for 'buffer' not being null terminated.
impact: False-positive
fix: suppress 'string_null'

open-vm-tools/lib/file/file.c
open-vm-tools/lib/file/fileLockPosix.c
open-vm-tools/lib/include/vmware/tools/gdp.h
open-vm-tools/vgauth/common/i18n.c
open-vm-tools/vgauth/serviceImpl/saml-xmlsec1.c

index ffe49417b98b1d01da1105dbdbf43253289b5312..246864ba5df1244652ff123d3539a9d95f69c8b7 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 1998-2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 1998-2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -2419,6 +2420,7 @@ FileRotateByRename(const char *fileName,  // IN: full path to file
 
       ASSERT(dst != fileName);
       Posix_Free(dst);
+      /* coverity[use_after_free] */
       dst = src;
    }
 }
index 8dec054ae7f55aad3e63c59809dea10eb71cb6f3..2cd388e8039abc3c16caa213e453aa75968f5e68 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2006-2019 VMware, Inc. All rights reserved.
+ * Copyright (c) 2006-2019,2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -238,6 +239,7 @@ FileLockProcessDescriptor(pid_t pid)  // IN:
        * properly handled.
        */
 
+      /* coverity[string_null] */
       p = strchr(buffer, '(');
 
       if ((p == NULL) || (p == buffer) || (*(p - 1) != ' ')) {
index ec59e06b583818bb76b12b015f6373b5101ba436..a3077b47662477dcbe1224a453eecb7cc6c6d236 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2020-2021,2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2020-2021,2023-2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -92,6 +93,8 @@ extern "C++" {
  *   - GdpEnum name
  *   - error-id string id
  *   - Default error message string
+ *
+ * GDP_ERR_MAX item MUST BE LAST
  */
 #define GDP_ERR_LIST                                      \
    GDP_ERR_ITEM(GDP_ERROR_SUCCESS = 0,                    \
@@ -117,7 +120,10 @@ extern "C++" {
                 "Operation timed out")                    \
    GDP_ERR_ITEM(GDP_ERROR_NO_SUBSCRIBERS,                 \
                 "no-subscribers",                         \
-                "No subscribers for data")
+                "No subscribers for data")                \
+   GDP_ERR_ITEM(GDP_ERR_MAX,                              \
+                "last-error",                             \
+                "last-error")
 
 /*
  * GdpError codes enum.
@@ -125,7 +131,6 @@ extern "C++" {
 #define GDP_ERR_ITEM(a, b, c) a,
 typedef enum GdpError {
    GDP_ERR_LIST
-   GDP_ERR_MAX
 } GdpError;
 #undef GDP_ERR_ITEM
 
index 6377f335fd1d4c041a299cf3db2506970399c4dd..a8d1310bfab4f4cb9b9b8ad79f619f9ab81a1983 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (C) 2011-2019 VMware, Inc. All rights reserved.
+ * Copyright (c) 2011-2019,2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -622,6 +623,7 @@ MsgLoadCatalog(const char *path)
           * If the local DictLL_UnmarshalLine() returns NULL, name and value
           * will remain NULL pointers.  No malloc'ed memory to free here.
           */
+         /* coverity[leaked_storage] */
          break;
       }
 
index f0b83f73d84585a249e56139e7265b2156da2896..917e49f4b10552ea51533c6c336770da57c7a94e 100644 (file)
@@ -1,5 +1,6 @@
 /*********************************************************
- * Copyright (c) 2016-2023 VMware, Inc. All rights reserved.
+ * Copyright (c) 2016-2024 Broadcom. All rights reserved.
+ * The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries.
  *
  * 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
@@ -1222,6 +1223,7 @@ BuildCertChain(xmlNodePtr x509Node,
       /*
        * Add cert to the keymanager.
        */
+      /* coverity[string_null] */
       ret = xmlSecCryptoAppKeysMngrCertLoadMemory(mgr,
                                                   pemCert,
                                                   (xmlSecSize) strlen(pemCert),
@@ -1734,6 +1736,7 @@ SAML_VerifyBearerTokenAndChain(const char *xmlText,
       if (err != VGAUTH_E_OK) {
          VMXLog_Log(VMXLOG_LEVEL_WARNING,
                     "Unrelated certs found in SAML token, failing\n");
+         FreeCertArray(num, certChain);
          return VGAUTH_E_AUTHENTICATION_DENIED;
       }
    }