evolution-data-server r10118 - trunk/camel
- From: tobiasmue svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r10118 - trunk/camel
- Date: Mon, 2 Mar 2009 01:37:37 +0000 (UTC)
Author: tobiasmue
Date: Mon Mar 2 01:37:37 2009
New Revision: 10118
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=10118&view=rev
Log:
2009-03-02 Matt McCutchen <matt mattmccutchen net>
* evolution-data-server/camel/camel-mime-filter-tohtml.c:
(append_string_verbatim), (html_convert): Entity-encode the text and
target URL of links when formatting plain text mail to HTML for display.
** Part of fix for bug 549838
Modified:
trunk/camel/ChangeLog
trunk/camel/camel-mime-filter-tohtml.c
Modified: trunk/camel/camel-mime-filter-tohtml.c
==============================================================================
--- trunk/camel/camel-mime-filter-tohtml.c (original)
+++ trunk/camel/camel-mime-filter-tohtml.c Mon Mar 2 01:37:37 2009
@@ -134,6 +134,18 @@
return filter->outbuf + offset;
}
+static char *
+append_string_verbatim (CamelMimeFilter *filter, const char *str, char *outptr, char **outend)
+{
+ size_t len = strlen (str);
+
+ outptr = check_size (filter, outptr, outend, len);
+ memcpy(outptr, str, len);
+ outptr += len;
+
+ return outptr;
+}
+
static int
citation_depth (const char *in)
{
@@ -303,7 +315,7 @@
#define CONVERT_URLS (CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)
if (html->flags & CONVERT_URLS) {
- size_t matchlen, buflen, len;
+ size_t matchlen, len;
urlmatch_t match;
len = inptr - start;
@@ -319,25 +331,30 @@
matchlen = match.um_eo - match.um_so;
- buflen = 20 + strlen (match.prefix) + matchlen + matchlen;
- outptr = check_size (filter, outptr, &outend, buflen);
-
/* write out the href tag */
- outptr = g_stpcpy (outptr, "<a href=\"");
- outptr = g_stpcpy (outptr, match.prefix);
- memcpy (outptr, start, matchlen);
- outptr += matchlen;
- outptr = g_stpcpy (outptr, "\">");
+ outptr = append_string_verbatim (filter, "<a href=\"", outptr, &outend);
+ /* prefix shouldn't need escaping, but let's be safe */
+ outptr = writeln (filter,
+ (const unsigned char *)match.prefix,
+ (const unsigned char *)match.prefix + strlen (match.prefix),
+ outptr, &outend);
+ outptr = writeln (filter,
+ (const unsigned char *)start,
+ (const unsigned char *)start + matchlen,
+ outptr, &outend);
+ outptr = append_string_verbatim (filter, "\">", outptr, &outend);
/* now write the matched string */
- memcpy (outptr, start, matchlen);
+ outptr = writeln (filter,
+ (const unsigned char *)start,
+ (const unsigned char *)start + matchlen,
+ outptr, &outend);
html->column += matchlen;
- outptr += matchlen;
start += matchlen;
len -= matchlen;
/* close the href tag */
- outptr = g_stpcpy (outptr, "</a>");
+ outptr = append_string_verbatim (filter, "</a>", outptr, &outend);
} else {
/* nothing matched so write out the remainder of this line buffer */
outptr = writeln (filter, (const unsigned char *)start, (const unsigned char *)start + len, outptr, &outend);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]