descriptor leak in MimeDecode

Marion Hakanson <[email protected]> Fri, 30 May 2008 19:31:03 -0700
Newsgroups gmane.mail.exmh.devel
Message-ID <[email protected]>
Greetings,

A recent conversion from GroupWise to Exchange at our site, and the
corresponding change in mime-encoding practices involved with forwarding
messages through Exchange, have uncovered a file descriptor leak in
our beloved exhm-2.7.2.

The leak only happens when decoding "quoted-printable" parts using
the Tcl mime-decoding routines (my desktop system doesn't currently
have the "mimencode" utility installed, so exmh falls back to the
slower builtin method).  Here is a patch to lib/mime.tcl which fixes
the problem:

===============================================
--- /usr/local/exmh-2.7.2/lib/mime.tcl.0        Fri May 26 16:24:51 2006
+++ /usr/local/exmh-2.7.2/lib/mime.tcl  Fri May 30 19:29:16 2008
@@ -1482,6 +1482,7 @@
                   } else {
                       puts -nonewline $out [::mime::qp_decode $buffer]
                   }
+                  catch {close $in}
                 }
            }
            .*uue.* {
===============================================

Regards,

Marion