On Thu, 12 Mar 2009, Mantis Bug Tracker wrote:

>
> The following issue has been SUBMITTED.
> ======================================================================
> http://www.dbmail.org/mantis/view.php?id=780
> ======================================================================
> Reported By:                pavels
> Assigned To:
> ======================================================================
> Project:                    DBMail
> Issue ID:                   780
> Category:                   IMAP daemon
> Reproducibility:            always
> Severity:                   major
> Priority:                   normal
> Status:                     new
> target:
> ======================================================================
> Date Submitted:             12-Mar-09 15:48 CET
> Last Modified:              12-Mar-09 15:48 CET
> ======================================================================
> Summary:                    Same as 
> http://www.dbmail.org/mantis/view.php?id=675
> (wrong boundary detection)
> Description:
> Issue 0000675 is closed (resolved in 2.3.2) but i have still this issue in
> 2.3.5
>
> After some debugging i found that find_boundary (dbmail-message.c) doesn't
> work for me
>
> I use:
> postgresql 8.3.4
> dbmail 2.3.5
> glib 2.14.5
> gmime 2.1.19
>
>
> Here is the patch that works for me:
>
> --- dbmail-message.c  2009-01-06 12:51:55.000000000 +0100
> +++ dbmail-message-new.c      2009-03-12 15:38:47.000000000 +0100
> @@ -279,7 +279,16 @@
>               return NULL;
>
>       header = g_string_new("");
> -     i = 13;
> +     i = 0;
> +
> +     while (rest[i]) {
> +             if (rest[i] == ':')
> +             {
> +                     break;
> +             }
> +             i++;
> +     }

If the loop is left because rest[i] == 0

> +     i++;

now rest[i] is the character after the '\0' so the following loop could 
process garbage...

>       while (rest[i]) {
>               if (((rest[i] == '\n') || (rest[i] == '\r')) && 
> (!isspace(rest[i+1])))
> {
>                       break;
>

The following is a better version (I hope):

--- dbmail-message.c    2009-01-06 12:51:55.000000000 +0100
+++ dbmail-message-new.c        2009-03-12 15:38:47.000000000 +0100
@@ -279,7 +279,16 @@
                return NULL;

        header = g_string_new("");
-       i = 13;
+       i = 0;
+
+       while (rest[i]) {
+               if (rest[i] == ':')
+               {
+                       i++;
+                       break;
+               }
+               i++;
+       }
        while (rest[i]) {
                if (((rest[i] == '\n') || (rest[i] == '\r')) && 
(!isspace(rest[i+1])))
{
                        break;

Martin
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://mailman-new.icns.fastxs.net/cgi-bin/mailman/listinfo/dbmail-dev

Reply via email to