From 277d70d881a99e563cfa1c4eee4cc0e77c17ea7d Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Wed, 18 Mar 2020 01:36:38 -0600 Subject: * Fixes to documentation provided by Dennis Davis. * Bug that makes Alpine split encoded words in the subkect of a message in the middle of a utf-8 character into two encoded words, breaking the encoding. Reported by Jean Chevalier. --- pith/charset.c | 29 ++++++++++++++++++++++++++--- pith/pine.hlp | 22 +++++++++++----------- 2 files changed, 37 insertions(+), 14 deletions(-) diff --git a/pith/charset.c b/pith/charset.c index f651abe9..b3d44d42 100644 --- a/pith/charset.c +++ b/pith/charset.c @@ -593,9 +593,32 @@ rfc1522_encoded_word(unsigned char *s, int enc, char *charset) for(goal = ((goal / 4) * 3) - 2; goal && *s; goal--, s++) ; else /* special 'Q' encoding */ - for(; goal && *s; s++) - if((goal -= RFC1522_ENC_CHAR(*s) ? 3 : 1) < 0) - break; + if(!strucmp(charset, "UTF-8")){ /* special handling for utf-8 */ + int i,more; + unsigned char *p; + for(; goal && *s; s++){ + more = *s < 0x80 ? 0 + : *s < 0xe0 ? 1 + : *s < 0xf0 ? 2 + : *s < 0xf8 ? 3 + : *s < 0xfc ? 4 + : *s < 0xfe ? 5 : -1; + if(more >= 0){ /* check that we have at least more characters */ + for(p = s, i = 0; i <= more && *p != '\0'; i++, p++) + goal -= RFC1522_ENC_CHAR(*p) ? 3 : 1; + if(goal < 0) /* does not fit in encoded word */ + break; + s += i - 1; /* i - 1 should be equal to more */ + } + else /* encode it, and skip it */ + if((goal -= RFC1522_ENC_CHAR(*s) ? 3 : 1) < 0) + break; + } + } + else + for(; goal && *s; s++) + if((goal -= RFC1522_ENC_CHAR(*s) ? 3 : 1) < 0) + break; return(s); } diff --git a/pith/pine.hlp b/pith/pine.hlp index fdb24c3f..3a358fbd 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 411 2020-02-29 14:37:03 +Alpine Commit 412 2020-03-18 01:36:29 ============= h_news ================= @@ -174,9 +174,8 @@ Apache web server.

New in Alpine ()

This is a development version of Alpine. These enhancements are -released after the release of version - (). Please report -any problems you find with this release. +released after the release of version 2.22. Please report any +problems you find with this release.

Additions include: @@ -197,22 +196,23 @@ any problems you find with this release.

  • New variable system-certs-file that allows users to configure the location of a container of certificate authority (CA) certificates to be used to validate certificates of remote servers. - -
  • Crash in Alpine when attempting to reply to a multipart/alternative - message that is malformed, and the option to include attachments in - reply is enabled. Reported and patched by Peter Tirsek. -

    Bug fixes include +

    +Bugs that have been addressed include:

    -Version () -addresses bugs found in previous releases and has a few additions as well. +Version 2.22 addresses bugs found in previous releases and has several +additions as well.

    Additions include: -- cgit v1.2.3-70-g09d2