From f79c4faf50deeee2fda26c675b38da3ad019a489 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sun, 11 Jan 2004 04:28:52 +0000 Subject: if e_iconv() returns -1, check that errno != EINVAL - if errno *is* 2004-01-10 Jeffrey Stedfast * camel-mime-utils.c (rfc2047_encode_word): if e_iconv() returns -1, check that errno != EINVAL - if errno *is* EINVAL, it just means that our convlen wasn't long enough to include the whole sequence. This is fine, we'll just start where we left off next loop thru. Fixes bug #52593 (the buffer was duplicated because state wasn't flushed). (camel_header_encode_string): Fixed a type-o in loop where encoding=0, don't g_string_append_len starting at 'word' inptr-start bytes long - 'word' could be NULL and/or inptr-start could be longer than inptr-word. svn path=/trunk/; revision=24149 --- camel/ChangeLog | 32 +++++++++++++++++++++++++------- camel/camel-mime-utils.c | 9 +++++---- 2 files changed, 30 insertions(+), 11 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index b2a1449066..81660155b9 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,16 @@ +2004-01-10 Jeffrey Stedfast + + * camel-mime-utils.c (rfc2047_encode_word): if e_iconv() returns + -1, check that errno != EINVAL - if errno *is* EINVAL, it just + means that our convlen wasn't long enough to include the whole + sequence. This is fine, we'll just start where we left off next + loop thru. Fixes bug #52593 (the buffer was duplicated because + state wasn't flushed). + (camel_header_encode_string): Fixed a type-o in loop where + encoding=0, don't g_string_append_len starting at 'word' + inptr-start bytes long - 'word' could be NULL and/or inptr-start + could be longer than inptr-word. + 2004-01-09 Rodney Dawes * providers/groupwise/Makefile.am (EXTRA_DIST): libcamelgroupwise.urls @@ -5,8 +18,9 @@ 2004-01-09 Sivaiah Nallagatla - * providers/groupwise/groupwise-config-listener.c (is_groupwise_account): added null check - for source url to take care of accounts with Server Types as "None" + * providers/groupwise/groupwise-config-listener.c + (is_groupwise_account): added null check for source url to take + care of accounts with Server Types as "None" 2004-01-09 Not Zed @@ -36,12 +50,16 @@ 2004-01-08 Sivaiah Nallagatla - * providers/Makefile.am : add groupwise to SUBDIRS - * providers/groupwise/camel-groupwise-provider.c: new camel provider for groupwise - * providers/groupwise/groupwise-config-listener.[ch] : new class to add e-sources for groupwise calender and tasks - * providers/groupwise/Makefile.am : added new files to Makefile.am - + * providers/Makefile.am : add groupwise to SUBDIRS + + * providers/groupwise/camel-groupwise-provider.c: new camel + provider for groupwise + * providers/groupwise/groupwise-config-listener.[ch] : new class + to add e-sources for groupwise calender and tasks + + * providers/groupwise/Makefile.am : added new files to Makefile.am + 2004-01-05 JP Rosevear * camel-utf8.c: include sys/types.h for freebsd diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c index 88a7c2ad9b..83caa8f1d2 100644 --- a/camel/camel-mime-utils.c +++ b/camel/camel-mime-utils.c @@ -1250,7 +1250,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * hopefully-small-enough chunks, and leave it at that */ convlen = MIN(inlen, CAMEL_FOLD_PREENCODED); p = inptr; - if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1) { + if (e_iconv (ic, &inptr, &convlen, &out, &outlen) == (size_t) -1 && errno != EINVAL) { w(g_warning("Conversion problem: conversion truncated: %s", strerror (errno))); /* blah, we include it anyway, better than infinite loop ... */ inptr = p + convlen; @@ -1279,7 +1279,7 @@ rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char * g_string_append (outstring, ascii); } } - + if (ic != (iconv_t) -1) e_iconv_close (ic); } @@ -1334,13 +1334,14 @@ camel_header_encode_string (const unsigned char *in) if (g_unichar_isspace (c) && !last_was_space) { /* we've reached the end of a 'word' */ if (word && !(last_was_encoded && encoding)) { + /* output lwsp between non-encoded words */ g_string_append_len (out, start, word - start); start = word; } switch (encoding) { case 0: - out = g_string_append_len (out, word, inptr - start); + g_string_append_len (out, start, inptr - start); last_was_encoded = FALSE; break; case 1: @@ -1388,7 +1389,7 @@ camel_header_encode_string (const unsigned char *in) switch (encoding) { case 0: - out = g_string_append_len (out, start, inptr - start); + g_string_append_len (out, start, inptr - start); break; case 1: if (last_was_encoded) -- cgit v1.2.3