aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
diff options
context:
space:
mode:
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);