commit-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Mailutils branch, master, updated. rel-2_1-78-gd31b2f9


From: Sergey Poznyakoff
Subject: [SCM] GNU Mailutils branch, master, updated. rel-2_1-78-gd31b2f9
Date: Thu, 29 Apr 2010 11:08:48 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Mailutils".

http://git.savannah.gnu.org/cgit/mailutils.git/commit/?id=d31b2f980ff7e040103428d9cfb227df6e260c6e

The branch, master has been updated
       via  d31b2f980ff7e040103428d9cfb227df6e260c6e (commit)
       via  37f87dce4a7b47cb4b61163b6f66ea6658eaf23b (commit)
       via  b4b8b6ec832014c02a51cdcf4ce84bd38cc3f05f (commit)
       via  21b82ef506c8be16a2022324cd3678a421b85a91 (commit)
      from  1a771a60bf194a84f8e2df404a768ea71623fbf9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d31b2f980ff7e040103428d9cfb227df6e260c6e
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Apr 29 14:08:01 2010 +0300

    Minor change
    
    * libproto/include/mime0.h (struct _mu_mime): Use size_t for
    offsets, ssize_t for line_ndx.

commit 37f87dce4a7b47cb4b61163b6f66ea6658eaf23b
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Apr 29 13:59:30 2010 +0300

    Allow for a sequence of semicolons before kw/value pair in a structured 
header.
    
    * mailbox/mimehdr.c (_header_get_param): Skip superfluous semicolons.

commit b4b8b6ec832014c02a51cdcf4ce84bd38cc3f05f
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Apr 29 13:38:32 2010 +0300

    Remove line length limitation in mime parser.
    
    * libproto/include/mime0.h (struct _mu_mime): New member line_size.
    * mailbox/mime.c (_mime_setup_buffers): Use line_size instead of
    MIME_MAX_HDR_LEN.
    (_mime_parse_mpart_message): Reallocate cur_line as necessary.
    (mu_mime_create): Initialize line_size.

commit 21b82ef506c8be16a2022324cd3678a421b85a91
Author: Sergey Poznyakoff <address@hidden>
Date:   Thu Apr 29 13:34:30 2010 +0300

    Allow for certain class of broken headers.
    
    * mailbox/mimehdr.c (_header_get_param): Tolerate unquoted value parts
    which contain tspecials, except ';'.

-----------------------------------------------------------------------

Summary of changes:
 libproto/include/mime0.h |   31 ++++++++++++++++---------------
 mailbox/mime.c           |   16 ++++++++++++----
 mailbox/mimehdr.c        |   14 +++++++++++++-
 3 files changed, 41 insertions(+), 20 deletions(-)

diff --git a/libproto/include/mime0.h b/libproto/include/mime0.h
index 145db33..c1bce64 100644
--- a/libproto/include/mime0.h
+++ b/libproto/include/mime0.h
@@ -58,27 +58,28 @@ struct _mu_mime
   int             flags;
   char           *content_type;
 
-  int             tparts;
-  int             nmtp_parts;
+  size_t          tparts;
+  size_t          nmtp_parts;
   struct _mime_part **mtp_parts;      /* list of parts in the msg */
   char           *boundary;
-  int             cur_offset;
-  int             cur_part;
-  int             part_offset;
-  int             boundary_len;
-  int             preamble;
-  int             postamble;
+  size_t          cur_offset;
+  size_t          cur_part;
+  size_t          part_offset;
+  size_t          boundary_len;
+  size_t          preamble;
+  size_t          postamble;
   /* parser state */
   char           *cur_line;
-  int             line_ndx;
+  ssize_t         line_ndx;
+  size_t          line_size;
   char           *cur_buf;
-  int             buf_size;
+  size_t          buf_size;
   char           *header_buf;
-  int             header_buf_size;
-  int             header_length;
-  int             body_offset;
-  int             body_length;
-  int             body_lines;
+  size_t          header_buf_size;
+  size_t          header_length;
+  size_t          body_offset;
+  size_t          body_length;
+  size_t          body_lines;
   int             parser_state;
 };
 
diff --git a/mailbox/mime.c b/mailbox/mime.c
index 421d686..33186d9 100644
--- a/mailbox/mime.c
+++ b/mailbox/mime.c
@@ -224,7 +224,7 @@ _mime_setup_buffers (mu_mime_t mime)
       return ENOMEM;
     }
   if (mime->cur_line == NULL
-      && (mime->cur_line = calloc (MIME_MAX_HDR_LEN, 1)) == NULL)
+      && (mime->cur_line = calloc (mime->line_size, 1)) == NULL)
     {
       free (mime->cur_buf);
       return ENOMEM;
@@ -380,10 +380,17 @@ _mime_parse_mpart_message (mu_mime_t mime)
                }
            }
          mime->line_ndx++;
-         if (mime->line_ndx >= MIME_MAX_HDR_LEN)
+         if (mime->line_ndx >= mime->line_size)
            {
-             mime->line_ndx = 0;
-             mime->parser_state = MIME_STATE_BEGIN_LINE;
+             size_t newsize = mime->line_size + MIME_MAX_HDR_LEN;
+             char *p = realloc (mime->cur_line, newsize);
+             if (!p)
+               {
+                 ret = ENOMEM;
+                 break;
+               }
+             mime->cur_line = p;
+             mime->line_size = newsize;
            }
          mime->cur_offset++;
          nbytes--;
@@ -806,6 +813,7 @@ mu_mime_create (mu_mime_t *pmime, mu_message_t msg, int 
flags)
            {
              mime->msg = msg;
              mime->buf_size = MIME_DFLT_BUF_SIZE;
+             mime->line_size = MIME_MAX_HDR_LEN;
              mu_message_get_body (msg, &body);
              mu_body_get_stream (body, &(mime->stream));
            }
diff --git a/mailbox/mimehdr.c b/mailbox/mimehdr.c
index 3391868..731e485 100644
--- a/mailbox/mimehdr.c
+++ b/mailbox/mimehdr.c
@@ -144,6 +144,18 @@ _header_get_param (const char *field_body,
       
       /* walk upto start of param */      
       p = mu_str_skip_class (p + 1, MU_CTYPE_SPACE);
+
+      /* Reportedly, some MUAs insert several semicolons */
+      if (*p == ';')
+       continue;
+
+      /* Ignore stray characters */
+      if (_ISSPECIAL (*p))
+       {
+         p = strchr (p, ';');
+         continue;
+       }
+       
       if ((ep = strchr (p, '=')) == NULL)
        break;
       /* Allow for optional whitespace after '=' */
@@ -176,7 +188,7 @@ _header_get_param (const char *field_body,
        }
       else
        {
-         for (e = v + 1; !(_ISSPECIAL (*e) || mu_isspace (*e)); e++)
+         for (e = v + 1; *e && !(*e == ';' || mu_isspace (*e)); e++)
            ;
          len = e - v;
        }


hooks/post-receive
-- 
GNU Mailutils




reply via email to

[Prev in Thread] Current Thread [Next in Thread]