[Mimedefang] Do not use razor2.61 ! (was Mimedefang segfaults/crashes)

Martin Blapp mb at imp.ch
Sun Aug 1 08:10:53 EDT 2004


And here is a workaround:

> Razor 2.40 is fine, Razor 2.61 crashes on some mail
> because it normalizes emails from html first and
> there is a bug in there.

and this patch (not 100% correct) seems to fix it. It just takes one
byte away from the raw mailinput and terminates it properly with '\0'.
There must be an 'off-by-one' somewere, but I haven't been able to
track it down.

The scanoutput on 1800 mails was exactly the same on both tests.

Martin

--- Razor2-Preproc-deHTMLxs/_deHTMLxs.c Thu Jun 17 00:44:35 2004
+++ Razor2-Preproc-deHTMLxs/_deHTMLxs.c Sun Aug  1 09:48:54 2004
@@ -177,13 +177,17 @@
                    break;

                case '&':
-                   *t++ = html_tagxlat(&s);
+                   if (t != NULL)
+                           *t++ = html_tagxlat(&s);
                    break;

                default:
                valid:
-                   if (!tag)
-                       *t++ = c;
+                   if (!tag) {
+                       if (t != NULL ) {
+                               *t++ = c;
+                       }
+                   }
                    break;
            }

--- Razor2-Preproc-deHTMLxs/deHTMLxs.xs Sun Aug  1 13:55:03 2004
+++ Razor2-Preproc-deHTMLxs/deHTMLxs.xs Sun Aug  1 13:52:28 2004
@@ -191,6 +191,7 @@
             text = SvRV(scalarref);
             raw = SvPV(text,size);

+           *(raw + size - 1) = '\0';
             if ( (cleaned = malloc(size+1)) &&
                  (res = html_strip(raw, cleaned))  // html_strip will memset cleaned to 0
                  ) {



More information about the MIMEDefang mailing list