aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/GetFPath.c
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib/src/GetFPath.c')
-rw-r--r--nx-X11/lib/src/GetFPath.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/nx-X11/lib/src/GetFPath.c b/nx-X11/lib/src/GetFPath.c
index 3d87e4f64..87d257615 100644
--- a/nx-X11/lib/src/GetFPath.c
+++ b/nx-X11/lib/src/GetFPath.c
@@ -69,15 +69,20 @@ char **XGetFontPath(
/*
* unpack into null terminated strings.
*/
- chend = ch + (nbytes + 1);
- length = *ch;
+ chend = ch + nbytes;
+ length = *(unsigned char *)ch;
for (i = 0; i < rep.nPaths; i++) {
if (ch + length < chend) {
flist[i] = ch+1; /* skip over length */
ch += length + 1; /* find next length ... */
- length = *ch;
+ length = *(unsigned char *)ch;
*ch = '\0'; /* and replace with null-termination */
count++;
+ } else if (i == 0) {
+ Xfree(flist);
+ Xfree(ch);
+ flist = NULL;
+ break;
} else
flist[i] = NULL;
}