aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Args.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c
index ee18f3b0d..14f696e2d 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Args.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c
@@ -2098,31 +2098,24 @@ void ddxUseMsg()
static int nxagentGetDialogName()
{
- snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
-
if (*nxagentSessionId != '\0')
{
int length = strlen(nxagentSessionId);
- strcpy(nxagentDialogName, "NX - ");
-
/* if the session id contains an MD5 hash in a well-known format cut it off */
if (length > (MD5_LENGTH * 2 + 1) &&
*(nxagentSessionId + (length - (MD5_LENGTH * 2 + 1))) == '-')
{
- strncat(nxagentDialogName, nxagentSessionId,
- MIN(NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName), length - (MD5_LENGTH * 2 + 1)) - 1);
- }
- else
- {
- strncat(nxagentDialogName, nxagentSessionId, NXAGENTDIALOGNAMELENGTH - strlen(nxagentDialogName) - 1);
+ length -= (MD5_LENGTH * 2 + 1);
}
- nxagentDialogName[NXAGENTDIALOGNAMELENGTH - 1] = '\0';
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX - %.*s", length, nxagentSessionId);
return 1;
}
+ snprintf(nxagentDialogName, NXAGENTDIALOGNAMELENGTH, "NX");
+
return 0;
}