diff options
author | Sheldon Hearn <sheldonh@FreeBSD.org> | 2002-04-03 16:11:21 +0000 |
---|---|---|
committer | Sheldon Hearn <sheldonh@FreeBSD.org> | 2002-04-03 16:11:21 +0000 |
commit | c0c117ad27811ee2b114f42a3603050d22ecb8a4 (patch) | |
tree | a7720c3a7a713ca4dd82014f504d6ec0066ac370 /mail/exim-old | |
parent | Add kanjipad, a Japanese handwriting recognition tool. (diff) |
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.
Notes
Notes:
svn path=/head/; revision=57262
Diffstat (limited to 'mail/exim-old')
-rw-r--r-- | mail/exim-old/files/patch-src::expand.c | 15 | ||||
-rw-r--r-- | mail/exim-old/files/patch-src::filter.c | 62 |
2 files changed, 77 insertions, 0 deletions
diff --git a/mail/exim-old/files/patch-src::expand.c b/mail/exim-old/files/patch-src::expand.c new file mode 100644 index 000000000000..60de46082f1b --- /dev/null +++ b/mail/exim-old/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-old/files/patch-src::filter.c b/mail/exim-old/files/patch-src::filter.c new file mode 100644 index 000000000000..8e6e040f3c11 --- /dev/null +++ b/mail/exim-old/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 |