From 37394bd64d6ca075a65f21f4f1a4dd84e5212ca5 Mon Sep 17 00:00:00 2001 From: Paul Mangan Date: Sat, 25 Jan 2003 00:46:20 +0000 Subject: [PATCH 1/1] conv_encode_header(): fix bug when long headers with 8-bit characters are used --- configure.ac | 2 +- src/codeconv.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index aba4f2fd0..3dcbd2a6a 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,7 @@ MINOR_VERSION=8 MICRO_VERSION=9 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=claws +EXTRA_VERSION=claws1 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION dnl set $target diff --git a/src/codeconv.c b/src/codeconv.c index 25c0e38d1..166e53073 100644 --- a/src/codeconv.c +++ b/src/codeconv.c @@ -1044,7 +1044,7 @@ void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str, #define B64LEN(len) ((len) / 3 * 4 + ((len) % 3 ? 4 : 0)) -#define LBREAK_IF_REQUIRED(cond) \ +#define LBREAK_IF_REQUIRED(cond, plaintext) \ { \ if (len - (destp - dest) < MAX_LINELEN + 2) { \ *destp = '\0'; \ @@ -1054,7 +1054,7 @@ void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str, if ((cond) && *srcp) { \ if (destp > dest && isspace(*(destp - 1))) \ destp--; \ - else if (isspace(*srcp)) \ + else if (plaintext && isspace(*srcp)) \ srcp++; \ if (*srcp) { \ *destp++ = '\n'; \ @@ -1097,12 +1097,12 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src, left = MAX_LINELEN - header_len; while (*srcp) { - LBREAK_IF_REQUIRED(left <= 0); + LBREAK_IF_REQUIRED(left <= 0, TRUE); while (isspace(*srcp)) { *destp++ = *srcp++; left--; - LBREAK_IF_REQUIRED(left <= 0); + LBREAK_IF_REQUIRED(left <= 0, TRUE); } /* output as it is if the next word is ASCII string */ @@ -1110,9 +1110,9 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src, gint word_len; word_len = get_next_word_len(srcp); - LBREAK_IF_REQUIRED(left < word_len); + LBREAK_IF_REQUIRED(left < word_len, TRUE); while (word_len > 0) { - LBREAK_IF_REQUIRED(left <= 0); + LBREAK_IF_REQUIRED(left <= 0, TRUE); *destp++ = *srcp++; left--; word_len--; @@ -1167,7 +1167,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src, cur_len += mb_len; p += mb_len; } else if (cur_len == 0) { - LBREAK_IF_REQUIRED(1); + LBREAK_IF_REQUIRED(1, FALSE); continue; } else { cont = TRUE; @@ -1210,7 +1210,7 @@ void conv_encode_header(gchar *dest, gint len, const gchar *src, left -= mime_block_len; } - LBREAK_IF_REQUIRED(cont); + LBREAK_IF_REQUIRED(cont, FALSE); if (cur_len == 0) break; -- 2.25.1