aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.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/NXdixfonts.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/NXdixfonts.c')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
index 49d864887..db555d5fc 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c
@@ -121,7 +121,7 @@ static const char *_NXGetFontPath(const char *path)
if (fontEnv != NULL && *fontEnv != '\0')
{
- if (strlen(fontEnv) + 1 > 1024)
+ if (strlen(fontEnv) + 1 > sizeof(_NXFontPath))
{
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: WARNING! Maximum length of font path exceeded.\n");
@@ -140,8 +140,8 @@ static const char *_NXGetFontPath(const char *path)
_NXGetFontPathError:
- strncpy(_NXFontPath, path, 1023);
- _NXFontPath[1023] = '\0';
+ strncpy(_NXFontPath, path, sizeof(_NXFontPath) - 1);
+ _NXFontPath[sizeof(_NXFontPath) - 1] = '\0';
#ifdef NX_TRANS_TEST
fprintf(stderr, "_NXGetFontPath: Using default font path [%s].\n", _NXFontPath);
@@ -199,7 +199,7 @@ doOpenFont(ClientPtr client, OFclosurePtr c)
BitmapFormatScanlineUnit8;
- nxagentOrigFontNameLen = (c -> origFontNameLen < 256) ? c -> origFontNameLen : 255;
+ nxagentOrigFontNameLen = (c -> origFontNameLen < sizeof(nxagentOrigFontName) ? c -> origFontNameLen : sizeof(nxagentOrigFontName) - 1);
memcpy(nxagentOrigFontName, c -> origFontName, nxagentOrigFontNameLen);