diff options
-rw-r--r-- | camel/ChangeLog | 2 | ||||
-rw-r--r-- | camel/camel-mime-utils.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index de5d145e77..6c587fe801 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -5,6 +5,8 @@ us-ascii. We just have to encode high chars into utf-8. (header_decode_text): Call append_latin1 for appending unencoded text segments. + (append_latin1): Do an additional mask for account for c's + undefined behaviour for sign extension whilst shifting right. 2000-08-30 Jeffrey Stedfast <fejj@helixcode.com> diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 193d9d00c5..749c968279 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -927,7 +927,7 @@ append_latin1(GString *out, const char *in, int len) c = (unsigned int)*in++; len--; if (c & 0x80) { - out = g_string_append_c(out, 0xc0 | (c>>6)); /* 110000xx */ + out = g_string_append_c(out, 0xc0 | ((c>>6) & 0x3)); /* 110000xx */ out = g_string_append_c(out, 0x80 | (c&0x3f)); /* 10xxxxxx */ } else { out = g_string_append_c(out, c); |