freebsd-ports/mail/qmail/files/patch-alloc.c
Kurt Jaeger 8a56ada4da mail/qmail: Fixes CVE-2005-1513 to CVE-2005-1513, update TLS patch
mail/qmail-tls: Update TLS patch

See
https://www.qualys.com/2020/05/19/cve-2005-1513/remote-code-execution-qmail.txt
for details about the CVEs

- now builds with openssl 1.1.1e from the ports

PR:		244969, 245010
Submitted by:	erdgeist@erdgeist.org (maintainer)
Reported by:	klokanek@eldar.cz
MFH:		2020Q2
Security:	CVE-2005-1513, CVE-2005-1514, CVE-2005-1515
2020-05-24 12:59:01 +00:00

19 lines
502 B
C

diff -r -u a/alloc.c b/alloc.c
--- alloc.c 1998-06-15 03:53:16.000000000 -0700
+++ alloc.c 2020-05-04 16:43:32.923310325 -0700
@@ -1,3 +1,4 @@
+#include <limits.h>
#include "alloc.h"
#include "error.h"
extern char *malloc();
@@ -15,6 +16,10 @@
unsigned int n;
{
char *x;
+ if (n >= (INT_MAX >> 3)) {
+ errno = error_nomem;
+ return 0;
+ }
n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
if (n <= avail) { avail -= n; return space + avail; }
x = malloc(n);