30 lines
1.2 KiB
Diff
30 lines
1.2 KiB
Diff
diff -ru open-vm-tools-10.3.0-8931395-orig/libDeployPkg/linuxDeploymentUtilities.c open-vm-tools-10.3.0-8931395/libDeployPkg/linuxDeploymentUtilities.c
|
|
--- open-vm-tools-10.3.0-8931395-orig/libDeployPkg/linuxDeploymentUtilities.c 2018-06-23 03:04:54.000000000 -0700
|
|
+++ open-vm-tools-10.3.0-8931395/libDeployPkg/linuxDeploymentUtilities.c 2019-02-02 15:45:50.228320875 -0800
|
|
@@ -102,7 +102,6 @@
|
|
HasCustomScript(const char* dirPath, char** scriptName)
|
|
{
|
|
bool hasScript = false;
|
|
- size_t scriptSize;
|
|
static const char *customScriptRegex = "^script[A-Za-z0-9]*\\.bat";
|
|
DIR *tempDir;
|
|
struct dirent *dir;
|
|
@@ -124,16 +123,13 @@
|
|
}
|
|
while ((dir = readdir(tempDir)) != NULL) {
|
|
if (!regexec(&scriptRegex, dir->d_name, 0, NULL, 0)) {
|
|
- scriptSize = strlen(dir->d_name);
|
|
- *scriptName = malloc(sizeof(char) * scriptSize + 1);
|
|
+ *scriptName = strdup(dir->d_name);
|
|
if (*scriptName == NULL) {
|
|
sLog(log_warning, "Could not allocate memory for scriptName: %s",
|
|
strerror(errno));
|
|
closedir(tempDir);
|
|
goto done;
|
|
}
|
|
- **scriptName = '\0';
|
|
- strncat(*scriptName, dir->d_name, scriptSize);
|
|
hasScript = true;
|
|
}
|
|
}
|