From 2ba23b3bcf8f51d12c34582c8e0c51abebad6fda Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 5 Feb 2017 21:35:33 +0000 Subject: For consistency, apply patch from previous commit (630a7c3) to the original Xserver/dix/dixfonts.c file, although the code is undef'ed when NXAGENT_SERVER is defined. --- nx-X11/programs/Xserver/dix/dixfonts.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index bbce105e3..4ac9fa696 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -1824,6 +1824,9 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths, int *error) int SetDefaultFontPath(char *path) { + char *temp_path, + *start, + *end; unsigned char *cp, *pp, *nump, @@ -1834,12 +1837,36 @@ SetDefaultFontPath(char *path) size = 0, bad; + /* ensure temp_path contains "built-ins" */ + start = path; + while (1) { + start = strstr(start, "built-ins"); + if (start == NULL) + break; + end = start + strlen("built-ins"); + if ((start == path || start[-1] == ',') && (!*end || *end == ',')) + break; + start = end; + } + if (!start) { + if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") + == -1) + temp_path = NULL; + } + else { + temp_path = strdup(path); + } + if (!temp_path) + return BadAlloc; + /* get enough for string, plus values -- use up commas */ - len = strlen(path) + 1; + len = strlen(temp_path) + 1; nump = cp = newpath = (unsigned char *) ALLOCATE_LOCAL(len); - if (!newpath) + if (!newpath) { + free(temp_path); return BadAlloc; - pp = (unsigned char *) path; + } + pp = (unsigned char *) temp_path; cp++; while (*pp) { if (*pp == ',') { @@ -1858,6 +1885,7 @@ SetDefaultFontPath(char *path) err = SetFontPathElements(num, newpath, &bad, TRUE); DEALLOCATE_LOCAL(newpath); + free(temp_path); return err; } -- cgit v1.2.3