aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2018-01-02 19:23:20 +0100
committerUlrich Sibiller <uli42@gmx.de>2018-01-07 01:27:07 +0100
commitea1e0bea3c41f5c8ad8fc3e22ecd8f2d44e82685 (patch)
treeb05045a170123c3c4f0ae79940c3187cb6d6250a /nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
parent9a6b90c316e6ad2a5180ee9be4b0c9c7139d86b7 (diff)
downloadnx-libs-ea1e0bea3c41f5c8ad8fc3e22ecd8f2d44e82685.tar.gz
nx-libs-ea1e0bea3c41f5c8ad8fc3e22ecd8f2d44e82685.tar.bz2
nx-libs-ea1e0bea3c41f5c8ad8fc3e22ecd8f2d44e82685.zip
Replace hardcoded string lengths by macros
Diffstat (limited to 'nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index 563dacd92..e59144f94 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
@@ -96,7 +96,8 @@ static Bool doListFontsAndAliases(ClientPtr client, LFclosurePtr c);
#ifdef NX_TRANS_SOCKET
-char _NXFontPath[1024];
+#define NXFONTPATHLENGTH 1024
+char _NXFontPath[NXFONTPATHLENGTH];
/*
* Override the default font path and make
@@ -121,7 +122,7 @@ static const char *_NXGetFontPath(const char *path)
if (fontEnv != NULL && *fontEnv != '\0')
{
- if (strlen(fontEnv) + 1 > sizeof(_NXFontPath))
+ if (strlen(fontEnv) + 1 > NXFONTPATHLENGTH)
{
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
@@ -129,7 +130,7 @@ static const char *_NXGetFontPath(const char *path)
goto _NXGetFontPathError;
}
- strcpy(_NXFontPath, fontEnv);
+ snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", fontEnv);
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using NX font path [%s].\n", _NXFontPath);
@@ -140,7 +141,7 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
- snprintf(_NXFontPath, sizeof(_NXFontPath), "%s", path);
+ snprintf(_NXFontPath, NXFONTPATHLENGTH, "%s", path);
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);