aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/GetFPath.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-10-23 12:14:51 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2018-10-23 12:14:51 +0200
commit2eb4a65ebd9aa04bd663fb9a7f0680fd2c56e990 (patch)
treeeb5f9616387784ec1a5914395a9e3355baca2ce4 /nx-X11/lib/src/GetFPath.c
parent3dc4595560b34242fe4705af8c93d0024eeb2c56 (diff)
parent701e702a121029098a6123bee9e43a9b81f4b3d9 (diff)
downloadnx-libs-2eb4a65ebd9aa04bd663fb9a7f0680fd2c56e990.tar.gz
nx-libs-2eb4a65ebd9aa04bd663fb9a7f0680fd2c56e990.tar.bz2
nx-libs-2eb4a65ebd9aa04bd663fb9a7f0680fd2c56e990.zip
Merge branch 'uli42-pr/libX11_1.6.6' into 3.6.x
Attributes GH PR #722: https://github.com/ArcticaProject/nx-libs/pull/722
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;
}