aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/Display.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2017-11-24 00:25:25 +0100
committerUlrich Sibiller <uli42@gmx.de>2018-01-07 01:27:07 +0100
commit4a345786c6ee3b00882f015a7ac7d1d3215c0b9f (patch)
treefbae0fcf24922faac3c972c73bc89d624ecb727e /nx-X11/programs/Xserver/hw/nxagent/Display.c
parent5987a7b1af09e97271be3da74d336a64435e759a (diff)
downloadnx-libs-4a345786c6ee3b00882f015a7ac7d1d3215c0b9f.tar.gz
nx-libs-4a345786c6ee3b00882f015a7ac7d1d3215c0b9f.tar.bz2
nx-libs-4a345786c6ee3b00882f015a7ac7d1d3215c0b9f.zip
Dialog.c,Display.c,NXdixfonts.c: replace strncpy() by snprintf where appropriate
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/Display.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Display.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c
index 5943e538e..f523dacde 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Display.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c
@@ -1150,9 +1150,7 @@ void nxagentOpenDisplay(int argc, char *argv[])
if (*nxagentDisplayName == '\0')
{
- strncpy(nxagentDisplayName, XDisplayName(NULL), sizeof(nxagentDisplayName) - 1);
-
- nxagentDisplayName[sizeof(nxagentDisplayName) - 1] = '\0';
+ snprintf(nxagentDisplayName, sizeof(nxagentDisplayName), "%s", XDisplayName(NULL));
}
nxagentCloseDisplay();
@@ -1846,7 +1844,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
{
strncpy(singlePath, path, (unsigned long)(end - path));
- singlePath[(unsigned long)(end - path)] = 0;
+ singlePath[(unsigned long)(end - path)] = '\0';
path = end + 1;
}
@@ -1859,7 +1857,7 @@ static FILE *nxagentLookForIconFile(char *iconName, const char *permission,
if (singlePath[strlen(singlePath)- 1] == slash[0])
{
- singlePath[strlen(singlePath)- 1] = 0;
+ singlePath[strlen(singlePath)- 1] = '\0';
}
if (strlen(singlePath) + strlen(iconName) + 1 < sizeof(singlePath)<)
@@ -1907,8 +1905,8 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask)
agentIconData=nxagentIconData;
}
-
- snprintf(default_path, PATH_MAX-1, "/usr/NX/share/images/%s", agent_icon_name);
+ /* FIXME: use a compile time define here, /usr/NX is a nomachine path */
+ snprintf(default_path, sizeof(default_path), "/usr/NX/share/images/%s", agent_icon_name);
if ((icon_fp = fopen(default_path, "r")) == NULL)
{