diff --git a/configure.ac b/configure.ac index 748b8ce..6924e10 100644 --- a/configure.ac +++ b/configure.ac @@ -41,6 +41,8 @@ case $host_os in ;; esac +AC_CHECK_HEADERS([stdint.h]) + # Checks for pkg-config packages PKG_CHECK_MODULES(XFS, libfs xfont xtrans) XFS_CFLAGS="$XFS_CFLAGS $OS_CFLAGS" diff --git a/difs/fontinfo.c b/difs/fontinfo.c index 23893e0..f10b705 100644 --- a/difs/fontinfo.c +++ b/difs/fontinfo.c @@ -62,6 +62,21 @@ in this Software without prior written authorization from The Open Group. #include #include +#ifdef HAVE_CONFIG_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif +#include +#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 +196,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;