diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2018-01-02 21:02:41 +0100 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2018-01-07 01:27:07 +0100 |
commit | a8a693817ddb84143ffea22668c32f755336ce09 (patch) | |
tree | 190c78611bbcdc9d3e9d6edcf2e302db65d46d9e /nx-X11/programs/Xserver | |
parent | 19a3918a7216ac1006bdfd96239fafc6eb97d523 (diff) | |
download | nx-libs-a8a693817ddb84143ffea22668c32f755336ce09.tar.gz nx-libs-a8a693817ddb84143ffea22668c32f755336ce09.tar.bz2 nx-libs-a8a693817ddb84143ffea22668c32f755336ce09.zip |
Font.c: pass down size
Diffstat (limited to 'nx-X11/programs/Xserver')
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Font.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 39c3b31e1..5a9b729ed 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -109,7 +109,7 @@ static void nxagentFontReconnect(FontPtr, XID, void *); static XFontStruct *nxagentLoadBestQueryFont(Display* dpy, char *fontName, FontPtr pFont); static XFontStruct *nxagentLoadQueryFont(register Display *dpy , char *fontName , FontPtr pFont); int nxagentFreeFont(XFontStruct *fs); -static Bool nxagentGetFontServerPath(char * fontServerPath); +static Bool nxagentGetFontServerPath(char * fontServerPath, int size); static char * nxagentMakeScalableFontName(const char *fontName, int scalableResolution); @@ -1283,7 +1283,7 @@ Bool nxagentReconnectFailedFonts(void *p0) fprintf(stderr, "nxagentReconnectFailedFonts: \n"); #endif - if (nxagentGetFontServerPath(fontServerPath) == False) + if (nxagentGetFontServerPath(fontServerPath, sizeof(fontServerPath)) == False) { #ifdef WARNING fprintf(stderr, "nxagentReconnectFailedFonts: WARNING! " @@ -1404,19 +1404,18 @@ Bool nxagentDisconnectAllFonts() return True; } -static Bool nxagentGetFontServerPath(char * fontServerPath) +static Bool nxagentGetFontServerPath(char * fontServerPath, int size) { - /* ensure path is no longer than fontServerPath */ char path[256] = {0}; if (NXGetFontParameters(nxagentDisplay, sizeof(path), path) == True) { + /* the length is stored in the first byte and is therefore limited to 255 */ unsigned int len = *path; if (len) { - strncpy(fontServerPath, path + 1, len); - fontServerPath[len] = '\0'; + snprintf(fontServerPath, MIN(size, len + 1), "%s", path + 1); #ifdef TEST fprintf(stderr, "nxagentGetFontServerPath: Got path [%s].\n", |