You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rj...@apache.org on 2014/01/12 14:06:42 UTC

svn commit: r1557528 - /httpd/mod_mbox/trunk/module-2.0/mod_mbox.c

Author: rjung
Date: Sun Jan 12 13:06:42 2014
New Revision: 1557528

URL: http://svn.apache.org/r1557528
Log:
Escape ampersand in message id by percent encoding
as %26 instead of & after encoding via ap_escape_uri().

This seems to fix INFRA-7171 and PR 55981.
Code already runs on mail-archives.eu since a few days.

Modified:
    httpd/mod_mbox/trunk/module-2.0/mod_mbox.c

Modified: httpd/mod_mbox/trunk/module-2.0/mod_mbox.c
URL: http://svn.apache.org/viewvc/httpd/mod_mbox/trunk/module-2.0/mod_mbox.c?rev=1557528&r1=1557527&r2=1557528&view=diff
==============================================================================
--- httpd/mod_mbox/trunk/module-2.0/mod_mbox.c (original)
+++ httpd/mod_mbox/trunk/module-2.0/mod_mbox.c Sun Jan 12 13:06:42 2014
@@ -214,8 +214,8 @@ char *mbox_msg_id_escape(apr_pool_t *p, 
     /* first, count the number of extra characters */
     for (i = 0, j = 0; s[i] != '\0'; i++)
         if (s[i] == '&')
-            /* Length of "&" minus 1 (original character "&") */
-            j += 4;
+            /* Length of "%26" minus 1 (original character "&") */
+            j += 2;
 
     if (j == 0)
         return s;
@@ -223,8 +223,8 @@ char *mbox_msg_id_escape(apr_pool_t *p, 
     x = apr_palloc(p, i + j + 1);
     for (i = 0, j = 0; s[i] != '\0'; i++, j++) {
         if (s[i] == '&') {
-            strncpy(&x[j], "&", 5);
-            j += 4;
+            strncpy(&x[j], "%26", 3);
+            j += 2;
         }
         else
             x[j] = s[i];