aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2018-01-07 01:29:13 +0100
committerMihai Moldovan <ionic@ionic.de>2018-01-07 01:29:13 +0100
commit5f9f744cd8497ac250717951512fa32d266a73a1 (patch)
treecb379a43f3775a032834cd816e6d41663970001c /nx-X11/programs/Xserver/hw/nxagent/Dialog.c
parent3c81899718e3429e45381beaaba58d4886a5537c (diff)
parent23c36c2d2c0d1ea85c1b638d71267c28522c08cd (diff)
downloadnx-libs-5f9f744cd8497ac250717951512fa32d266a73a1.tar.gz
nx-libs-5f9f744cd8497ac250717951512fa32d266a73a1.tar.bz2
nx-libs-5f9f744cd8497ac250717951512fa32d266a73a1.zip
Merge branch 'uli42-pr/fix_strings' into 3.6.x
Attributes GH PR #567: https://github.com/ArcticaProject/nx-libs/pull/567
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Dialog.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Dialog.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
index b7852a0ac..c09618693 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
@@ -66,9 +66,9 @@ int nxagentDisableDeferModePid = 0;
static int nxagentFailedReconnectionDialogPid = 0;
-char nxagentPulldownWindow[16];
+char nxagentPulldownWindow[NXAGENTPULLDOWNWINDOWLENGTH];
-char nxagentFailedReconnectionMessage[256];
+char nxagentFailedReconnectionMessage[NXAGENTFAILEDRECONNECTIONMESSAGELENGTH];
void nxagentResetDialog(int pid)
{
@@ -279,16 +279,13 @@ void nxagentLaunchDialog(DialogType dialogType)
if (dialogType == DIALOG_FAILED_RECONNECTION)
{
- strncpy(dialogDisplay, nxagentDisplayName, 255);
+ snprintf(dialogDisplay, sizeof(dialogDisplay), "%s", nxagentDisplayName);
}
else
{
- strcpy(dialogDisplay, ":");
- strncat(dialogDisplay, display, 254);
+ snprintf(dialogDisplay, sizeof(dialogDisplay), ":%s", display);
}
- *(dialogDisplay + 255) = '\0';
-
/*
* We don't want to receive SIGCHLD
* before we store the child pid.
@@ -308,7 +305,7 @@ void nxagentLaunchDialog(DialogType dialogType)
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
#endif
- *dialogDisplay = '\0';
+ dialogDisplay[0] = '\0';
/*
* Restore the previous set of
@@ -320,8 +317,7 @@ void nxagentLaunchDialog(DialogType dialogType)
void nxagentPulldownDialog(Window wid)
{
- snprintf(nxagentPulldownWindow, 15, "%ld", (long int) wid);
- nxagentPulldownWindow[15] = 0;
+ snprintf(nxagentPulldownWindow, NXAGENTPULLDOWNWINDOWLENGTH, "%ld", (long int) wid);
#ifdef TEST
fprintf(stderr, "nxagentPulldownDialog: Going to launch pulldown "
@@ -330,7 +326,7 @@ void nxagentPulldownDialog(Window wid)
nxagentLaunchDialog(DIALOG_PULLDOWN);
- nxagentPulldownWindow[0] = 0;
+ nxagentPulldownWindow[0] = '\0';
}
void nxagentFailedReconnectionDialog(int alert, char *error)
@@ -372,9 +368,7 @@ void nxagentFailedReconnectionDialog(int alert, char *error)
int status;
int options = 0;
- snprintf(nxagentFailedReconnectionMessage, 255, "Reconnection failed: %s", error);
-
- *(nxagentFailedReconnectionMessage + 255) = '\0';
+ snprintf(nxagentFailedReconnectionMessage, NXAGENTFAILEDRECONNECTIONMESSAGELENGTH, "Reconnection failed: %s", error);
nxagentLaunchDialog(DIALOG_FAILED_RECONNECTION);