aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/font/fontfile/dirfile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/nx-X11/lib/font/fontfile/dirfile.c b/nx-X11/lib/font/fontfile/dirfile.c
index f390391bc..3a2fead81 100644
--- a/nx-X11/lib/font/fontfile/dirfile.c
+++ b/nx-X11/lib/font/fontfile/dirfile.c
@@ -45,6 +45,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,
@@ -373,6 +374,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 = (char *) xrealloc(tokenBuf, nsize);
if (!nbuf)