From 1afb651874175658357df5a065ebcf49ee28705f Mon Sep 17 00:00:00 2001 From: Philipp Takacs Date: Fri, 12 Aug 2016 17:43:05 +0200 Subject: [PATCH] fix bug in decode_rfc2047() If iconv() returns an error and the source encoding is utf-8, the character jump has an of by one: the source string is incresed by one possition more the the length is decreased. --- sbr/fmt_rfc2047.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sbr/fmt_rfc2047.c b/sbr/fmt_rfc2047.c index 4145139..687ea57 100644 --- a/sbr/fmt_rfc2047.c +++ b/sbr/fmt_rfc2047.c @@ -318,8 +318,12 @@ decode_rfc2047(char *str, char *dst, size_t dstlen) break; /* skip to next input character */ if (fromutf8) { - for (start++;(start < q) && ((*start & 192) == 128);start++) + inbytes--; + start++; + while ((start < q) && ((*start & 192) == 128)) { + start++; inbytes--; + } } else start++, inbytes--; if (start >= q) -- 1.7.10.4