aboutsummaryrefslogtreecommitdiff
path: root/mail/qmail/files/patch-alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/qmail/files/patch-alloc.c')
-rw-r--r--mail/qmail/files/patch-alloc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/mail/qmail/files/patch-alloc.c b/mail/qmail/files/patch-alloc.c
new file mode 100644
index 000000000000..de741aa96bc5
--- /dev/null
+++ b/mail/qmail/files/patch-alloc.c
@@ -0,0 +1,19 @@
+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);