httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1325642 - in /httpd/mod_mbox/branches/convert-charsets/module-2.0: mod_mbox_cte.c mod_mbox_mime.c
Date Fri, 13 Apr 2012 08:05:21 GMT
Author: sf
Date: Fri Apr 13 08:05:21 2012
New Revision: 1325642

URL: http://svn.apache.org/viewvc?rev=1325642&view=rev
Log:
make mbox_cte_escape_html() and mbox_mime_get_body() always
NUL-terminates the result

Modified:
    httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_cte.c
    httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_mime.c

Modified: httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_cte.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_cte.c?rev=1325642&r1=1325641&r2=1325642&view=diff
==============================================================================
--- httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_cte.c (original)
+++ httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_cte.c Fri Apr 13 08:05:21
2012
@@ -80,6 +80,7 @@ const char *mbox_cte_to_char(mbox_cte_e 
 
 /* Unlike the original ap_escape_html, this one is also binary
  * safe.
+ * The result is always NUL-terminated
  */
 apr_size_t mbox_cte_escape_html(apr_pool_t *p, const char *s,
                                 apr_size_t len, char **body)
@@ -107,7 +108,7 @@ apr_size_t mbox_cte_escape_html(apr_pool
     /* Otherwise, we have some extra characters to insert : allocate
        enough space for them, and process the data. */
     else {
-        x = apr_palloc(p, i + j);
+        x = apr_palloc(p, i + j + 1);
 
         for (i = 0, j = 0; i < len; i++, j++) {
             if (s[i] == '<') {
@@ -126,6 +127,7 @@ apr_size_t mbox_cte_escape_html(apr_pool
                 x[j] = s[i];
             }
         }
+	x[j] = '\0';
     }
 
     *body = x;

Modified: httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_mime.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_mime.c?rev=1325642&r1=1325641&r2=1325642&view=diff
==============================================================================
--- httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_mime.c (original)
+++ httpd/mod_mbox/branches/convert-charsets/module-2.0/mod_mbox_mime.c Fri Apr 13 08:05:21
2012
@@ -394,7 +394,7 @@ char *mbox_mime_get_body(apr_pool_t *p, 
             if ((rv = mbox_cte_convert_to_utf8(p, m->charset, new_body, new_len, &vb))
                 == APR_SUCCESS) {
                 new_body = vb.buf;
-                new_len = vb.strlen;
+                new_len = vb.strlen + 1;
             }
             else {
                 ap_log_error(APLOG_MARK, APLOG_ERR, rv, ap_server_conf,



Mime
View raw message