]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix out-of-bound access issues reported by Coverity
authorKruti <kpendharkar@vmware.com>
Mon, 19 Feb 2024 14:32:44 +0000 (06:32 -0800)
committerKruti <kpendharkar@vmware.com>
Mon, 19 Feb 2024 14:32:44 +0000 (06:32 -0800)
Do not pass PATH_MAX and FILENAME_MAX to Str_Strlen function call.

open-vm-tools/libDeployPkg/linuxDeploymentUtilities.c

index 61ccd54d33a736531ee9426cff219c4ca1d3a4b1..9b36168b691be449bc5ce2dc8b9efb3fdadb551f 100644 (file)
@@ -82,8 +82,9 @@ IsCloudInitCustomizationEnabled()
          cloudInitConfigDirPath, strerror(errno));
    } else {
       for (i = fileCount - 1; i >= 0; i--) {
-         filePathLength = Str_Strlen(cloudInitConfigDirPath, PATH_MAX) +
-            Str_Strlen(fileList[i]->d_name, FILENAME_MAX) + 1;
+         filePathLength =
+            Str_Strlen(cloudInitConfigDirPath, sizeof(cloudInitConfigDirPath))
+            + Str_Strlen(fileList[i]->d_name, NAME_MAX) + 1;
          filePath = malloc(filePathLength);
          if (filePath == NULL) {
             sLog(log_warning, "Error allocating memory to copy '%s'.",