Unverified Commit 057ce728 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'uli42-pr/strings_fixes' into 3.6.x

parents 46ef20bd 80b6d6b9
...@@ -1296,7 +1296,17 @@ static void nxagentParseSingleOption(char *name, char *value) ...@@ -1296,7 +1296,17 @@ static void nxagentParseSingleOption(char *name, char *value)
} }
else if (strcmp(name, "clients") == 0) else if (strcmp(name, "clients") == 0)
{ {
snprintf(nxagentClientsLogName, NXAGENTCLIENTSLOGNAMELENGTH, "%s", value); char *new = strdup(value);
if (new)
{
SAFE_free(nxagentClientsLogName);
nxagentClientsLogName = new;
}
else
{
fprintf(stderr, "Warning: Ignoring option [%s] because of memory problems\n",
validateString(name));
}
return; return;
} }
else if (strcmp(name, "client") == 0) else if (strcmp(name, "client") == 0)
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "Args.h" #include "Args.h"
#include "Display.h" #include "Display.h"
#include "Dialog.h" #include "Dialog.h"
#include "Utils.h"
#include <nx/NX.h> #include <nx/NX.h>
#include "compext/Compext.h" #include "compext/Compext.h"
...@@ -182,7 +183,6 @@ void nxagentResetDialog(int pid) ...@@ -182,7 +183,6 @@ void nxagentResetDialog(int pid)
void nxagentLaunchDialog(DialogType dialogType) void nxagentLaunchDialog(DialogType dialogType)
{ {
char dialogDisplay[256];
sigset_t set, oldSet; sigset_t set, oldSet;
int *pid; int *pid;
char *type; char *type;
...@@ -302,13 +302,23 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -302,13 +302,23 @@ void nxagentLaunchDialog(DialogType dialogType)
fprintf(stderr, "nxagentLaunchDialog: Launching dialog type [%d] message [%s].\n", type, message); fprintf(stderr, "nxagentLaunchDialog: Launching dialog type [%d] message [%s].\n", type, message);
#endif #endif
char *dialogDisplay = NULL;
int len = 0;
if (dialogType == DIALOG_FAILED_RECONNECTION) if (dialogType == DIALOG_FAILED_RECONNECTION)
{ {
snprintf(dialogDisplay, sizeof(dialogDisplay), "%s", nxagentDisplayName); len = asprintf(&dialogDisplay, "%s", nxagentDisplayName);
} }
else else
{ {
snprintf(dialogDisplay, sizeof(dialogDisplay), ":%s", display); len = asprintf(&dialogDisplay, ":%s", display);
}
if (len == -1)
{
#ifdef DEBUG
fprintf(stderr, "%s: could not allocate display string.\n", __func__);
#endif
return;
} }
/* /*
...@@ -329,7 +339,7 @@ void nxagentLaunchDialog(DialogType dialogType) ...@@ -329,7 +339,7 @@ void nxagentLaunchDialog(DialogType dialogType)
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay); DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
#endif #endif
dialogDisplay[0] = '\0'; SAFE_free(dialogDisplay);
/* /*
* Restore the previous set of blocked signal. * Restore the previous set of blocked signal.
......
...@@ -30,8 +30,7 @@ ...@@ -30,8 +30,7 @@
* Clients log file name. * Clients log file name.
*/ */
#define NXAGENTCLIENTSLOGNAMELENGTH 256 extern char *nxagentClientsLogName;
extern char nxagentClientsLogName[NXAGENTCLIENTSLOGNAMELENGTH];
extern char nxagentVerbose; extern char nxagentVerbose;
......
...@@ -1449,13 +1449,8 @@ static char* getKeyboardFilePath(void) ...@@ -1449,13 +1449,8 @@ static char* getKeyboardFilePath(void)
{ {
if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1)) if ((asprintf(&keyboard_file_path, "%s/keyboard", sessionpath) == -1))
{ {
SAFE_free(sessionpath);
FatalError("malloc for keyboard file path failed."); FatalError("malloc for keyboard file path failed.");
} }
else
{
SAFE_free(sessionpath);
}
} }
else else
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment