aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-mime-utils.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-03-28 04:16:57 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-03-28 04:16:57 +0800
commit6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a (patch)
tree1f8976b0d4d45ea6853dd169d6a9ddb8d48aa79c /camel/camel-mime-utils.c
parenta4f6a54e0abacd14cd5971bb0e52e52cf38324f6 (diff)
downloadgsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar.gz
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar.bz2
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar.lz
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar.xz
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.tar.zst
gsoc2013-evolution-6ba4c3938c305de92ab8e6acbcfc708d8f2d6f9a.zip
When we remove a node from the list, make sure to g_list_free_1().
2003-03-27 Jeffrey Stedfast <fejj@ximian.com> * camel-mime-utils.c (header_encode_phrase_merge_words): When we remove a node from the list, make sure to g_list_free_1(). (header_encode_phrase_merge_words): Don't use CAMEL_FOLD_PREENCODED as the upper-bound for merged-word length if the merged-word will not be an rfc2047 encoded word. Instead, use CAMEL_FOLD_SIZE-8 (which is the value we use in other places for determining upper-bound lengths). Solves bug #38659. svn path=/trunk/; revision=20549
Diffstat (limited to 'camel/camel-mime-utils.c')
-rw-r--r--camel/camel-mime-utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 04fa0e6f90..6ba498ffa9 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1561,6 +1561,8 @@ header_encode_phrase_get_words (const unsigned char *in)
return words;
}
+#define MERGED_WORD_LT_FOLDLEN(wordlen, type) ((type) == WORD_2047 ? (wordlen) < CAMEL_FOLD_PREENCODED : (wordlen) < (CAMEL_FOLD_SIZE - 8))
+
static gboolean
header_encode_phrase_merge_words (GList **wordsp)
{
@@ -1578,13 +1580,15 @@ header_encode_phrase_merge_words (GList **wordsp)
next = nextl->data;
/* merge nodes of the same type AND we are not creating too long a string */
if (word_types_compatable (word->type, next->type)) {
- if (next->end - word->start < CAMEL_FOLD_PREENCODED) {
+ if (MERGED_WORD_LT_FOLDLEN (next->end - word->start, MAX (word->type, next->type))) {
/* the resulting word type is the MAX of the 2 types */
word->type = MAX(word->type, next->type);
word->end = next->end;
words = g_list_remove_link (words, nextl);
+ g_list_free_1 (nextl);
g_free (next);
+
nextl = g_list_next (wordl);
merged = TRUE;