aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-11-23 21:25:26 +0100
committerUlrich Sibiller <uli42@gmx.de>2018-01-07 01:27:07 +0100
commit5987a7b1af09e97271be3da74d336a64435e759a (patch)
tree5ee10aefa54ee4c4c1d4e7fd16c21206b2732399 /nx-X11/programs/Xserver/hw/nxagent/Dialog.c
parent3c81899718e3429e45381beaaba58d4886a5537c (diff)
downloadnx-libs-5987a7b1af09e97271be3da74d336a64435e759a.tar.gz
nx-libs-5987a7b1af09e97271be3da74d336a64435e759a.tar.bz2
nx-libs-5987a7b1af09e97271be3da74d336a64435e759a.zip
Dialog.c,Display.c,Font.c,NXdixfonts.c: don't use hardcoded string buffer lengths
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Dialog.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Dialog.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
index b7852a0ac..df6bb1c89 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c
@@ -279,15 +279,15 @@ void nxagentLaunchDialog(DialogType dialogType)
if (dialogType == DIALOG_FAILED_RECONNECTION)
{
- strncpy(dialogDisplay, nxagentDisplayName, 255);
+ strncpy(dialogDisplay, nxagentDisplayName, sizeof(dialogDisplay) - 1);
}
else
{
strcpy(dialogDisplay, ":");
- strncat(dialogDisplay, display, 254);
+ strncat(dialogDisplay, display, sizeof(dialogDisplay) - 1 - 1);
}
- *(dialogDisplay + 255) = '\0';
+ dialogDisplay[sizeof(dialogDisplay) - 1] = '\0';
/*
* We don't want to receive SIGCHLD
@@ -308,7 +308,7 @@ void nxagentLaunchDialog(DialogType dialogType)
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
#endif
- *dialogDisplay = '\0';
+ dialogDisplay[0] = '\0';
/*
* Restore the previous set of
@@ -320,8 +320,7 @@ void nxagentLaunchDialog(DialogType dialogType)
void nxagentPulldownDialog(Window wid)
{
- snprintf(nxagentPulldownWindow, 15, "%ld", (long int) wid);
- nxagentPulldownWindow[15] = 0;
+ snprintf(nxagentPulldownWindow, sizeof(nxagentPulldownWindow), "%ld", (long int) wid);
#ifdef TEST
fprintf(stderr, "nxagentPulldownDialog: Going to launch pulldown "
@@ -330,7 +329,7 @@ void nxagentPulldownDialog(Window wid)
nxagentLaunchDialog(DIALOG_PULLDOWN);
- nxagentPulldownWindow[0] = 0;
+ nxagentPulldownWindow[0] = '\0';
}
void nxagentFailedReconnectionDialog(int alert, char *error)
@@ -372,9 +371,7 @@ void nxagentFailedReconnectionDialog(int alert, char *error)
int status;
int options = 0;
- snprintf(nxagentFailedReconnectionMessage, 255, "Reconnection failed: %s", error);
-
- *(nxagentFailedReconnectionMessage + 255) = '\0';
+ snprintf(nxagentFailedReconnectionMessage, sizeof(nxagentFailedReconnectionMessage), "Reconnection failed: %s", error);
nxagentLaunchDialog(DIALOG_FAILED_RECONNECTION);