Gitweb:
http://git.exim.org/exim.git/commitdiff/cafbabb774a4721e4ae7de7746ec0fc27d90d8b1
Commit: cafbabb774a4721e4ae7de7746ec0fc27d90d8b1
Parent: 95fdc6efb795fe8f25bd76111b60e662a32a3531
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Sun Aug 17 19:10:36 2014 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Sun Aug 17 19:10:36 2014 +0100
Safer coding for utf8clean expansion operator
---
src/src/expand.c | 12 +++++-------
test/confs/0600 | 3 ++-
2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/src/src/expand.c b/src/src/expand.c
index 0b6513c..e3e1c78 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -6370,18 +6370,16 @@ while (*s != 0)
case EOP_UTF8CLEAN:
{
- int seq_len, index = 0;
+ int seq_len = 0, index = 0;
int bytes_left = 0;
+ long codepoint = -1;
uschar seq_buff[4]; /* accumulate utf-8 here */
while (*sub != 0)
{
- int complete;
- long codepoint;
- uschar c;
+ int complete = 0;
+ uschar c = *sub++;
- complete = 0;
- c = *sub++;
if (bytes_left)
{
if ((c & 0xc0) != 0x80)
@@ -6396,7 +6394,7 @@ while (*s != 0)
if (--bytes_left == 0) /* codepoint complete */
{
if(codepoint > 0x10FFFF) /* is it too large? */
- complete = -1; /* error */
+ complete = -1; /* error (RFC3629 limit) */
else
{ /* finished; output utf-8 sequence */
yield = string_cat(yield, &size, &ptr, seq_buff, seq_len);
diff --git a/test/confs/0600 b/test/confs/0600
index 0347e4c..61a9c08 100644
--- a/test/confs/0600
+++ b/test/confs/0600
@@ -1,4 +1,5 @@
-# Exim test configuration 0005
+# Exim test configuration 0600
+# utf8clean:string
exim_path = EXIM_PATH
host_lookup_order = bydns