aboutsummaryrefslogtreecommitdiffstats
path: root/mail/exim
diff options
context:
space:
mode:
authorsheldonh <sheldonh@FreeBSD.org>2002-04-04 00:11:21 +0800
committersheldonh <sheldonh@FreeBSD.org>2002-04-04 00:11:21 +0800
commit10e7bdec6f5ac6eafceb93280b9dd5c355e8dbc6 (patch)
treef05824f2edde4f30f968f9f59238b90651fbcaee /mail/exim
parent8a8d39e9a0c994918ed6dca9f1ca153c8c5fad35 (diff)
downloadfreebsd-ports-graphics-10e7bdec6f5ac6eafceb93280b9dd5c355e8dbc6.tar.gz
freebsd-ports-graphics-10e7bdec6f5ac6eafceb93280b9dd5c355e8dbc6.tar.zst
freebsd-ports-graphics-10e7bdec6f5ac6eafceb93280b9dd5c355e8dbc6.zip
Gracefully handle NULLs in the message body as exposed to filters,
by replacing them with spaces. This is a vendor-sanctioned patch, obtained from the exim-users mailing list.
Diffstat (limited to 'mail/exim')
-rw-r--r--mail/exim/files/patch-src::expand.c15
-rw-r--r--mail/exim/files/patch-src::filter.c62
2 files changed, 77 insertions, 0 deletions
diff --git a/mail/exim/files/patch-src::expand.c b/mail/exim/files/patch-src::expand.c
new file mode 100644
index 00000000000..60de46082f1
--- /dev/null
+++ b/mail/exim/files/patch-src::expand.c
@@ -0,0 +1,15 @@
+--- src/expand.c.orig Tue Feb 19 12:10:43 2002
++++ src/expand.c Wed Apr 3 18:11:56 2002
+@@ -572,10 +572,9 @@
+ lseek(deliver_datafile, start_offset, SEEK_SET);
+ len = read(deliver_datafile, body, len);
+ if (len >= 0) body[len] = 0;
+- while (*body != 0)
++ while (len > 0)
+ {
+- if (*body == '\n') *body = ' ';
+- body++;
++ if (body[--len] == '\n' || body[len] == 0) body[len] = ' ';
+ }
+ }
+ return (*ss == NULL)? "" : *ss;
diff --git a/mail/exim/files/patch-src::filter.c b/mail/exim/files/patch-src::filter.c
new file mode 100644
index 00000000000..8e6e040f3c1
--- /dev/null
+++ b/mail/exim/files/patch-src::filter.c
@@ -0,0 +1,62 @@
+--- src/filter.c.orig Tue Feb 19 12:10:43 2002
++++ src/filter.c Wed Apr 3 18:11:56 2002
+@@ -2566,12 +2566,12 @@
+ BOOL
+ filter_runtest(int fd, BOOL is_system, BOOL dot_ended)
+ {
+-int rc, body_len, action, header_size;
++int rc, body_len, body_end_len, action, header_size;
+ register int ch;
+ BOOL yield, delivered;
+ struct stat statbuf;
+ address_item *generated = NULL;
+-char *body, *error, *filebuf, *s;
++char *error, *filebuf, *s;
+
+ /* Read the filter file into store as will be done by the director
+ in a real case. */
+@@ -2653,7 +2653,7 @@
+ function as efficient as possible. Handling message_body_end is somewhat more
+ tedious. Pile it all into a circular buffer and sort out at the end. */
+
+-message_body = body = store_malloc(message_body_visible + 1);
++message_body = store_malloc(message_body_visible + 1);
+ message_body_end = store_malloc(message_body_visible + 1);
+ s = message_body_end;
+ body_len = 0;
+@@ -2729,24 +2729,25 @@
+ memcpy(temp, message_body_end, below);
+ memmove(message_body_end, s+1, above);
+ memcpy(message_body_end + above, temp, below);
+- message_body_end[message_body_visible] = 0;
++ s = message_body_end + message_body_visible;
+ }
+ }
+-else *s = 0;
+
+-/* Convert newlines in the body variables to spaces */
++*s = 0;
++body_end_len = s - message_body_end;
+
+-while (*body != 0)
++/* Convert newlines and nulls in the body variables to spaces */
++while (body_len > 0)
+ {
+- if (*body == '\n') *body = ' ';
+- body++;
++ if (message_body[--body_len] == '\n' || message_body[body_len] == 0)
++ message_body[body_len] = ' ';
+ }
+
+-body = message_body_end;
+-while (*body != 0)
++while (body_end_len > 0)
+ {
+- if (*body == '\n') *body = ' ';
+- body++;
++ if (message_body_end[--body_end_len] == '\n' ||
++ message_body_end[body_end_len] == 0)
++ message_body_end[body_end_len] = ' ';
+ }
+
+ /* Now pass the filter file to the function that interprets it. Because