aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile/dirfile.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-08 15:07:46 +0200
committermarha <marha@users.sourceforge.net>2014-06-08 15:07:46 +0200
commitb5a2c971202ff19079cb5a98253d8760ae124d15 (patch)
tree451469af3bf1c7d9ce0236ba546867bbf6a2fb3a /libXfont/src/fontfile/dirfile.c
parent71cc8d9b7dc729934a29445cbd6d1f7a6d9ecbec (diff)
parentd435b20322433b335a4fc5693cce0399a3f27b2d (diff)
downloadvcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.tar.gz
vcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.tar.bz2
vcxsrv-b5a2c971202ff19079cb5a98253d8760ae124d15.zip
Merge remote-tracking branch 'origin/released'
Conflicts: X11/Xwindows.h
Diffstat (limited to 'libXfont/src/fontfile/dirfile.c')
-rw-r--r--libXfont/src/fontfile/dirfile.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libXfont/src/fontfile/dirfile.c b/libXfont/src/fontfile/dirfile.c
index c8aff6f4f..639310c31 100644
--- a/libXfont/src/fontfile/dirfile.c
+++ b/libXfont/src/fontfile/dirfile.c
@@ -42,6 +42,7 @@ in this Software without prior written authorization from The Open Group.
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
+#include <limits.h>
static Bool AddFileNameAliases ( FontDirectoryPtr dir );
static int ReadFontAlias ( char *directory, Bool isFile,
@@ -90,7 +91,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
strcat(dir_file, FontDirFile);
file = fopen(dir_file, "rt");
if (file) {
-#ifndef WIN32
+#ifndef WIN32
if (fstat (fileno(file), &statb) == -1)
#else
if (stat (dir_file, &statb) == -1)
@@ -135,7 +136,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
FontFileAddFontFile (dir, font_name, file_name);
}
fclose(file);
-
+
} else if (errno != ENOENT) {
return BadFontPath;
}
@@ -188,7 +189,7 @@ FontFileDirectoryChanged(FontDirectoryPtr dir)
return TRUE;
return FALSE;
}
-
+
/*
* Make each of the file names an automatic alias for each of the files.
*/
@@ -212,7 +213,7 @@ AddFileNameAliases(FontDirectoryPtr dir)
renderer = FontFileMatchRenderer (fileName);
if (!renderer)
continue;
-
+
len = strlen (fileName) - renderer->fileSuffixLen;
if (len >= sizeof(copy))
continue;
@@ -374,6 +375,9 @@ lexAlias(FILE *file, char **lexToken)
int nsize;
char *nbuf;
+ if (tokenSize >= (INT_MAX >> 2))
+ /* Stop before we overflow */
+ return EALLOC;
nsize = tokenSize ? (tokenSize << 1) : 64;
nbuf = realloc(tokenBuf, nsize);
if (!nbuf)