diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/camel-mime-filter-enriched.c | 34 |
2 files changed, 28 insertions, 11 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 0b1745b5b9..6525fc4644 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2004-06-21 Jeffrey Stedfast <fejj@novell.com> + + * camel-mime-filter-enriched.c (enriched_to_html): Fixed a number + of issues described in bug #49497. + 2004-06-18 Jeffrey Stedfast <fejj@novell.com> * camel.c (camel_shutdown): Call camel_mime_utils_shutdown() and diff --git a/camel/camel-mime-filter-enriched.c b/camel/camel-mime-filter-enriched.c index b31502ead6..18c9a41746 100644 --- a/camel/camel-mime-filter-enriched.c +++ b/camel/camel-mime-filter-enriched.c @@ -316,12 +316,29 @@ enriched_to_html (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespa break; case '\n': - if (!(enriched->flags & IS_RICHTEXT) && enriched->nofill <= 0) { + if (!(enriched->flags & IS_RICHTEXT)) { /* text/enriched */ - while (inptr < inend && (outptr + 4) < outend && *inptr == '\n') { - memcpy (outptr, "<br>", 4); - outptr += 4; - inptr++; + if (enriched->nofill > 0) { + if ((outptr + 4) < outend) { + memcpy (outptr, "<br>", 4); + outptr += 4; + } else { + inptr--; + goto backup; + } + } else if (*inptr == '\n') { + if ((outptr + 4) >= outend) { + inptr--; + goto backup; + } + + while (inptr < inend && (outptr + 4) < outend && *inptr == '\n') { + memcpy (outptr, "<br>", 4); + outptr += 4; + inptr++; + } + } else { + *outptr++ = ' '; } } else { /* text/richtext */ @@ -391,18 +408,14 @@ enriched_to_html (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespa if (!strncasecmp (tag, "nofill>", 7)) { if ((outptr + 5) < outend) { - memcpy (outptr, "<pre>", 5); enriched->nofill++; - outptr += 5; } else { inptr = tag - 1; goto backup; } } else if (!strncasecmp (tag, "/nofill>", 8)) { if ((outptr + 6) < outend) { - memcpy (outptr, "</pre>", 6); enriched->nofill--; - outptr += 6; } else { inptr = tag - 1; goto backup; @@ -427,8 +440,7 @@ enriched_to_html (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespa while (inptr < inend && *inptr != '<') inptr++; -#define PARAM_TAG_MIN_LEN (sizeof ("<param>") + sizeof ("</param>") - 1) - if (inptr == inend || (inend - inptr) <= PARAM_TAG_MIN_LEN) { + if (inptr == inend || (inend - inptr) <= 15) { inptr = tag - 1; goto need_input; } |