summaryrefslogtreecommitdiff
path: root/app/xfs/difs/fontinfo.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-06-13 21:00:37 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-06-13 21:00:37 +0000
commit4d24003fedd96a6d1e7801d9dd99e48ade5ba410 (patch)
tree826d02765d6b23f62efc3d5cfd3785629f0a55f7 /app/xfs/difs/fontinfo.c
parent1d806dfb5f48abe149074e7e3df7b6a7b76f68ba (diff)
update to xfs 1.0.8.
(The multiple defined symbol problem is not fixed yet)
Diffstat (limited to 'app/xfs/difs/fontinfo.c')
-rw-r--r--app/xfs/difs/fontinfo.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/app/xfs/difs/fontinfo.c b/app/xfs/difs/fontinfo.c
index 23893e0af..a5615d439 100644
--- a/app/xfs/difs/fontinfo.c
+++ b/app/xfs/difs/fontinfo.c
@@ -48,6 +48,8 @@ in this Software without prior written authorization from The Open Group.
*/
/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.10 2001/12/14 20:01:34 dawes Exp $ */
+#include <xfs-config.h>
+
#include <X11/fonts/FS.h>
#include <X11/fonts/FSproto.h>
#include <stdio.h>
@@ -62,6 +64,18 @@ in this Software without prior written authorization from The Open Group.
#include <swapreq.h>
#include <swaprep.h>
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <limits.h>
+#ifndef SIZE_MAX
+# ifdef ULONG_MAX
+# define SIZE_MAX ULONG_MAX
+# else
+# define SIZE_MAX UINT_MAX
+# endif
+#endif
+
void
CopyCharInfo(
CharInfoPtr ci,
@@ -181,6 +195,8 @@ build_range(
return new;
}
+ if (src_num >= SIZE_MAX / sizeof(fsRange) * 2 - 1)
+ return NULL;
np = new = (fsRange *) fsalloc(sizeof(fsRange) * (src_num + 1) / 2);
if (!np)
return np;
@@ -210,6 +226,8 @@ build_range(
unsigned char *pp = src;
src_num = *num;
+ if (src_num >= SIZE_MAX / sizeof(fsRange))
+ return NULL;
np = new = (fsRange *) fsalloc(SIZEOF(fsRange) * src_num);
if (!np)
return np;