diff -up tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c.CVE-2016-8859 tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c --- tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c.CVE-2016-8859 2014-02-28 19:55:36.000000000 +0100 +++ tre-c2f5d130c91b1696385a6ae0b5bcfd5214bcc9ca/lib/tre-match-parallel.c 2016-11-02 22:07:41.984468354 +0100 @@ -59,6 +59,9 @@ char *alloca (); #ifdef HAVE_MALLOC_H #include #endif /* HAVE_MALLOC_H */ +#ifdef HAVE_STDINT_H +#include +#endif /* HAVE_STDINT_H */ #include "tre-internal.h" #include "tre-match-utils.h" @@ -153,7 +156,7 @@ tre_tnfa_run_parallel(const tre_tnfa_t * everything in a single large block from the stack frame using alloca() or with malloc() if alloca is unavailable. */ { - int tbytes, rbytes, pbytes, xbytes, total_bytes; + size_t tbytes, rbytes, pbytes, xbytes, total_bytes; char *tmp_buf; /* Compute the length of the block we need. */ tbytes = sizeof(*tmp_tags) * num_tags; @@ -168,11 +171,11 @@ tre_tnfa_run_parallel(const tre_tnfa_t * #ifdef TRE_USE_ALLOCA buf = alloca(total_bytes); #else /* !TRE_USE_ALLOCA */ - buf = xmalloc((unsigned)total_bytes); + buf = xmalloc(total_bytes); #endif /* !TRE_USE_ALLOCA */ if (buf == NULL) return REG_ESPACE; - memset(buf, 0, (size_t)total_bytes); + memset(buf, 0, total_bytes); /* Get the various pointers within tmp_buf (properly aligned). */ tmp_tags = (void *)buf;