aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/fontfile/dirfile.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2014-06-08 15:03:35 +0200
committermarha <marha@users.sourceforge.net>2014-06-08 15:03:35 +0200
commitd435b20322433b335a4fc5693cce0399a3f27b2d (patch)
tree8d96b388ee1058340a9d7c1a3c4096169ac3839f /libXfont/src/fontfile/dirfile.c
parent2614b017fb8a28f360897ece66815934fd1562f5 (diff)
downloadvcxsrv-d435b20322433b335a4fc5693cce0399a3f27b2d.tar.gz
vcxsrv-d435b20322433b335a4fc5693cce0399a3f27b2d.tar.bz2
vcxsrv-d435b20322433b335a4fc5693cce0399a3f27b2d.zip
Updated to libXfont 1.4.8
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)